INITIALIZE statement

The INITIALIZE statement sets selected categories of data fields to predetermined values. The INITIALIZE statement is functionally equivalent to one or more MOVE statements.

Format

Read syntax diagramSkip visual syntax diagramINITIALIZEidentifier-1WITHFILLERALLcategory-nameTOVALUETHENREPLACINGcategory-nameDATABYidentifier-2literal-1THENTODEFAULT
Where category-name is:
  • ALPHABETIC
  • ALPHANUMERIC
  • ALPHANUMERIC-EDITED
  • DBCS
  • EGCS
  • NATIONAL
  • NATIONAL-EDITED
  • NUMERIC
  • NUMERIC-EDITED
  • UTF-8
identifier-1
Receiving areas.

identifier-1 must reference one of the following items:

  • An alphanumeric group item
  • A national group item
  • A UTF-8 group item
  • An elementary data item of one of the following categories:
    • Alphabetic
    • Alphanumeric
    • Alphanumeric-edited
    • DBCS
    • External floating-point
    • Internal floating-point
    • National
    • National-edited
    • Numeric
    • Numeric-edited
    • UTF-8
  • A special register that is valid as a receiving operand in a MOVE statement with identifer-2 or literal-1 as the sending operand.

identifier-1 references an elementary item or a group item. The effect of the execution of an INITIALIZE statement is as if a series of implicit MOVE statements, each of which has an elementary data item as its receiving operand, were executed.

When identifier-1 references a national or UTF-8 group item, identifier-1 is processed as a group item.

identifier-1 cannot be a dynamic-length elementary item.

identifier-2, literal-1
Sending areas.

When identifier-2 references a national or UTF-8 group item, identifier-2 is processed as an elementary data item of category national or UTF-8, respectively.

identifier-2 must reference an elementary data item (or a national or UTF-8 group item treated as elementary) that is valid as a sending operand in a MOVE statement with identifier-1 as the receiving operand.

literal-1 must be a literal that is valid as a sending operand in a MOVE statement with identifier-1 as the receiving operand.

A subscripted item can be specified for identifier-1. A complete table can be initialized only by specifying identifier-1 as a group that contains the complete table.

Usage note: The data description entry for identifier-1 can contain the DEPENDING phrase of the OCCURS clause. However, you cannot use the INITIALIZE statement to initialize a variably-located item or a variable-length item.

The data description entry for identifier-1 must not contain a RENAMES clause.

Special registers can be specified for identifier-1 and identifier-2 only if they are valid receiving fields or sending fields, respectively, for the implied MOVE statements.

FILLER phrase

When the FILLER phrase is specified, the receiving elementary data items that have an explicit or implicit FILLER clause will be initialized.

VALUE phrase

When the VALUE phrase is specified:
  • If ALL is specified in the VALUE phrase, it is as if all of the categories listed in category-name were specified.
  • The same category cannot be repeated in a VALUE phrase.

REPLACING phrase

When the REPLACING phrase is specified:

  • identifier-2 must reference an item of a category that is valid as a sending operand in a MOVE statement to an item of the corresponding category specified in the REPLACING phrase.
  • literal-1 must be of a category that is valid as a sending operand in a MOVE statement to an item of the corresponding category specified in the REPLACING phrase.
  • A floating-point literal, a data item of category internal floating-point, or a data item of category external floating point is treated as if it were in the NUMERIC category.
  • The same category cannot be repeated in a REPLACING phrase.

With the exception of EGCS, the keyword after the word REPLACING corresponds to a category of data shown in Classes and categories of data.

EGCS in the REPLACING phrase is synonymous with DBCS.

Related references  
ALLOCATE statement