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

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-211
SET TO
Table 9-10 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.
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.
Table 9-10. Valid SET TO Combinations
Sending Item
Receiving Item
Integer Data Item Index-Name Index Data Name
Integer literal No (rule 3) OK (rule 1) No (rule 2)
Integer data item No (rule 3) OK (rule 1) No (rule 2)
Index-name OK (rule 3) OK (rule 1) OK (rule 2)
*
Index data item No (rule 3) OK (rule 1) OK (rule 2)*
* No conversion occurs