The INITIALIZE statement sets selected types of elementary data items to chosen values.
General Format
INITIALIZE { destination } ... [ WITH FILLER ]
[ REPLACING { {ALPHABETIC } DATA BY value }...]
{ALPHANUMERIC }
{NUMERIC }
{ALPHANUMERIC-EDITED}
{NUMERIC-EDITED }
Syntax Rules
- destination is a data item.
- value is a literal or a data item. It must be a legal source for a MOVE to the corresponding category of data. For example, a value
appearing in a REPLACING ALPHABETIC BY clause must have a category of alphabetic, alphanumeric, or alphanumeric-edited.
- The same category cannot be repeated in a REPLACING phrase.
- destination may not be an index data item.
- destination may not contain a RENAMES clause.
General Rules
- Whether
destination references an elementary item or a group item, all operations are performed as if a series of MOVE statements had been written,
each of which has an elementary item as its receiving field according to the following rules:
- If
destination is a group item, any elementary item contained in destination is initialized only if it belongs to a category specified by
the REPLACING phrase.
- If
destination is an elementary item, that item is initialized only if it belongs to a category specified in the REPLACING phrase.
- Each data item that is initialized is treated as the receiving operand of an implicit MOVE statement with the corresponding
value as the sending field.
- All elementary receiving fields, including all table occurrences, are affected, except as specified in the following rules.
- Index data items and elementary FILLER data items are not affected by the INITIALIZE statement, unless the optional WITH FILLER
phrase is specified, in which case FILLER data items are initialized.
- Any item that is subordinate to destination and which contains a REDEFINES clause, or any item that is subordinate to such
an item, is excluded from this operation. Destination itself, however, may be subordinate to a REDEFINES clause.
- If no REPLACING phrase is specified, alphabetic, alphanumeric, and alphanumeric-edited data items are initialized to SPACES;
numeric and numeric-edited data items are initialized to ZEROS.
- If multiple destinations are specified, they are initialized in the order written.
- destinations that are or contain OCCURS DEPENDING ON items will use the maximum number of occurrences when being initialized.