COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-93
INITIALIZE
Usage Considerations:
•
Execution of the INITIALIZE Statement
The INITIALIZE statement is equivalent to a series of MOVE statements, each of
which has an elementary item as its receiving operand.
•
Determining the Receiving Operands
If receiver includes reference modification, the data item to which it refers is
handled as an elementary item.
If receiver references an elementary data item, that data item is a receiving
operand unless the INITIALIZE statement includes a REPLACING phrase and the
category of the elementary data item is not specified in any of the phrases
following the REPLACING phrase. If receiver references an elementary data
item that is not a receiving operand, that data item is not initialized.
If receiver references a data structure, each elementary item subordinate to the
data structure (including each element in a subordinate table) is a receiving
operand; however, the initialize operation ignores:
°
Index or pointer data items
°
Elementary FILLER data items
°
Data items whose descriptions contain REDEFINES clauses
°
Data items subordinate to data items whose descriptions contain REDEFINES
clauses
°
Data items that are not in the same categories as the initial values specified for
them; for example, an ALPHABETIC receiver is not initialized to a
NUMERIC replacement value even if the INITIALIZE statement specifies
this
Example 9-36. INITIALIZE Statement
01 STOCK.
03 STOCK-ITEM OCCURS 500 TIMES.
05 S-NAME PIC X(30).
05 S-WHOLESALE-PRICE PIC $$$,$$$.99.
05 S-MARKUP-PCT PIC P999.
...
INITIALIZE STOCK
REPLACING NUMERIC-EDITED DATA BY ZERO