Format 1: SET for basic table handling
When this form of the SET statement is executed, the current value of the receiving field is replaced by the value of the sending field (with conversion).
- index-name-1
- Receiving field.
Must name an index that is specified in the INDEXED BY phrase of an OCCURS clause.
- identifier-1
- Receiving field.
Must name either an index data item or an elementary numeric integer item.
- index-name-2
- Sending
field.
Must name an index that is specified in the INDEXED BY phrase of an OCCURS clause. The value of the index before the SET statement is executed must correspond to an occurrence number of its associated table.
- identifier-2
- Sending field.
Must name either an index data item or an elementary numeric integer item.
- integer-1
- Sending field.
Must be a positive integer.
The following table shows valid combinations of sending and receiving fields in a format-1 SET statement.
Sending field | Index-name receiving field |
Index data item receiving field | Integer data item receiving field |
---|---|---|---|
Index-name* | Valid | Valid** | Valid |
Index data item* | Valid** | Valid** | Invalid |
Integer data item | Valid | Invalid | Invalid |
Integer literal | Valid | Invalid | Invalid |
*An index-name refers
to an index named in the INDEXED BY phrase of an OCCURS clause. An
index data item is defined with the USAGE IS INDEX clause. **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 identifier-1 is evaluated immediately before that receiving field is acted upon.
The value used for the sending field is the value at the beginning of SET statement execution.
The value of an index after execution of a SEARCH or PERFORM statement can be undefined; therefore, use a format-1 SET statement to reinitialize such indexes before you attempt other table-handling operations.
If index-name-2 is for a table that has a subordinate item that contains an OCCURS DEPENDING ON clause, then undefined values can be received into identifier-1.
For more information about complex OCCURS DEPENDING ON, see Complex OCCURS DEPENDING ON in the Enterprise COBOL Programming Guide.