Rational Developer for System z
COBOL for Windows, Version 7.5, Language Reference


INITIALIZE statement

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

Format
Read syntax diagramSkip visual syntax diagram               .--------------.  
               V              |  
>>-INITIALIZE----identifier-1-+--------------------------------->
 
>--+------------------------------------------------------------------------+-><
   |            .---------------------------------------------------------. |  
   |            V                                                         | |  
   '-REPLACING----+-ALPHABETIC----------+--+------+--BY--+-identifier-2-+-+-'  
                  +-ALPHANUMERIC--------+  '-DATA-'      '-literal-1----'      
                  +-ALPHANUMERIC-EDITED-+                                      
                  +-NATIONAL------------+                                      
                  +-NATIONAL-EDITED-----+                                      
                  +-NUMERIC-------------+                                      
                  +-NUMERIC-EDITED------+                                      
                  +-DBCS----------------+                                      
                  '-EGCS----------------'                                      
 
identifier-1
Receiving areas.

identifier-1 must reference one of the following:

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

identifier-2, literal-1
Sending areas.

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

identifier-2 must reference an elementary data item (or a national 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 group that follows a DEPENDING phrase of the OCCURS clause within the same 01-level 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.

REPLACING phrase

When the REPLACING phrase is specified:

The keyword following the word REPLACING corresponds to a category of data shown in Classes and categories of data.

When the REPLACING phrase is not specified:

INITIALIZE statement rules

  1. Whether identifier-1 references an elementary item, an alphanumeric group item, or a national group item, all operations are performed as if a series of MOVE statements had been written, each of which had an elementary item as a receiving field.

    If the REPLACING phrase is specified:

    Initialization takes place as if the data item referenced by identifier-2 or literal-1 were the sending operand in an implicit MOVE statement to the receiving item.

    All elementary receiving fields, including all occurrences of table items within the group, are initialized, with the following exceptions:

  2. The areas referenced by identifier-1 are initialized in the order (left to right) of the appearance of identifier-1 in the statement. Within a group receiving field, affected elementary items are initialized in the order of their definition within the group.
  3. If identifier-1 occupies the same storage area as identifier-2, the result of the execution of this statement is undefined, even if these operands are defined by the same data description entry.

Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)