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 ExtensionIBM Extension Identifier-1 cannot be a floating-point data item. End of IBM Extension
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 ExtensionIBM Extension Identifier-2 cannot be a floating-point data item. End of IBM Extension
End of IBM Extension - integer-1
- Sending field.
Must be a positive integer.
- Index-name receiving fields (index-name-1, and so on) are usually converted to a displacement value representing the occurrence number indicated by the sending field. To be valid, the resulting index-name value must correspond to an occurrence number in its associated table element. For the one exception, when the sending field is an index data item, the value in the index data item is placed in the index-name without change.
- Index data item receiving fields (identifier-1, and so on) are set equal to the contents of the sending field (which must be either an index-name or an index data item); no conversion takes place. A numeric integer or literal sending field must not be specified.
- Integer data item receiving fields (identifier-1, and so on) are set to the occurrence number associated with the sending field, which must be an index-name. An integer data item, an index data item, or a literal sending field must not be specified.
Table 1 shows valid combinations of sending and receiving fields in a 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
