ILE COBOL Language Reference

Format 1 - Initializing Index-names, Identifiers

When Format 1 of the SET statement is executed, the current value of the receiving field is replaced by the value of the sending field (with conversion).

SET Statement - Format 1
 
        .------------------.
        V                  |
>>-SET----+-index-name-1-+-+--TO--+-index-name-2-+-------------><
          '-identifier-1-'        +-identifier-2-+
                                  '-integer-1----'
 
 
index-name-1, identifier-1

Receiving fields.

Must be either index data items or elementary numeric integer items.

+-------------------------------IBM Extension--------------------------------+

Identifier-1 cannot be a floating-point data item.

+----------------------------End of IBM Extension----------------------------+

index-name-2
Sending field.

The value before the SET statement is executed must correspond to the occurrence number of its associated table.

identifier-2

Sending field.

Must be either an index data item or an elementary numeric integer item.

+-------------------------------IBM Extension--------------------------------+

Identifier-2 cannot be a floating-point data item.

+----------------------------End of IBM Extension----------------------------+

integer-1
Sending field.

Must be a positive integer.

Execution of the Format 1 SET statement depends upon the type of receiving field, as follows:

Table 32 shows valid combinations of sending and receiving fields in a Format 1 SET statement.

Table 32. Sending and Receiving Fields for Format 1 SET Statement

Sending Field Receiving Field
Index-name Index Data Item Integer Data Item
Index-name Valid Valid Valid
Index Data Item Valid* Valid* --
Integer Data Item Valid -- --
Integer Literal Valid -- --
*No conversion takes place

Receiving fields are acted upon in the left-to-right order in which they are specified. Any subscripting or indexing associated with an identifier's receiving field is evaluated immediately before the field is acted upon.

The value used for the sending field is the value at the beginning of SET statement execution.

The value for an index-name after execution of a SEARCH or PERFORM statement may be undefined; therefore, a Format 1 SET statement should reinitialize such index-names before other table-handling operations are attempted.

+-------------------------------IBM Extension--------------------------------+

If index-name-2 refers to a table that has a subordinate item that contains an OCCURS DEPENDING ON clause, identifier-1 may receive undefined values. For more information, see Appendix H, Complex OCCURS DEPENDING ON.

+----------------------------End of IBM Extension----------------------------+


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]