COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Table 68 summarizes these rules:
The receiving item (index-name-n ) is set to a value causing it to refer to the table
element corresponding in occurrence number to the table element specified by the sending
item (identifier-1, index-name-1, or integer ). If the sending item is an index
data item, or if it is an index-name that is related to the same table as the receiving item,
no conversion occurs.
If the receiving item is an index data item, it can be set equal to the contents of either an
index-name or another index data item. No conversion occurs.
If the receiving item is not an index data item, it can be set only to an occurrence number
corresponding to the value of an index-name. The sending item cannot be a numeric
integer literal or a numeric integer data item.
The assignment process is repeated for any other receiving data-names specified. Each
time, the value of a sending data item is used as it was at the beginning of the execution
of the statement. Any subscripting or indexing associated with the sending data item is
evaluated immediately before the value of the receiving data item is changed.
Table 68 Valid SET TO Combinations
Receiving Item
Index Data NameIndex-NameInteger Data ItemSending Item
No (rule 2)OK (rule 1)No (rule 3)Integer literal
No (rule 2)OK (rule 1)No (rule 3)Integer data item
OK (rule 2)*OK (rule 1)OK (rule 3)Index-name
OK (rule 2)*OK (rule 1)No (rule 3)Index data item
* No conversion occurs
Index Values Before and After Execution
If the sending item is an index-name, then before the execution of the SET TO statement, the
value of the index must correspond to an occurrence number of an element in the associated
table.
If the receiving item is an index-name, then after the execution of the SET TO statement, the
value of the index must correspond to an occurrence number of an element in the associated
table.
External Switches
The SET statement modifies the status of the external switch associated with each specified
mnemonic-name. When the SET statement changes the status of a switch to ON, any
condition-name associated (in the SPECIAL-NAMES paragraph) with the ON setting of that
switch evaluates to TRUE. When the SET statement changes the status of a switch to OFF, any
condition-name associated (in the SPECIAL-NAMES paragraph) with the ON setting of that
switch evaluates to FALSE.
Condition Names
The SET statement assigns to the conditional variable associated with the condition-name
the value of the first literal in the VALUE clause of the definition of the condition-name.
When more than one condition-name appears in the SET statement, the results are the
same as if a separate SET statement had been written for each condition-name in the same
order as specified in the SET statement.
SET 439