ILE COBOL Language Reference

Format 2 - Adjusting Index Values

When Format 2 of the SET statement is executed, the value of the receiving field is increased (UP BY) or decreased (DOWN BY) by a value that corresponds to the value in the sending field.

SET Statement - Format 2
 
        .--------------.
        V              |
>>-SET----index-name-3-+--+-UP BY---+--+-identifier-3-+--------><
                          '-DOWN BY-'  '-integer-2----'
 
 
index-name-3
This index-name value both before and after the SET statement execution must correspond to the occurrence numbers in an associated table.
identifier-3

This sending field must be an elementary integer data-item.

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

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

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

integer-2
This sending field must be an integer.

When Format 2 of the SET statement is executed, the contents of the receiving field are increased (UP BY) or decreased (DOWN BY) by a value that corresponds to the number of occurrences represented by the value of identifier-3 or integer-2.

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

If index-name-3 refers to a table that has a subordinate item that contains an OCCURS DEPENDING ON clause, and if the ODO object is changed before executing a Format 2 SET Statement, index-name-3 cannot contain a value that corresponds to an occurrence number of its associated table. For more information, see Appendix H, Complex OCCURS DEPENDING ON.

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

Receiving fields are acted upon in the left-to-right order in which they are specified. The value of the incrementing or decrementing field at the beginning of SET statement execution is used for all receiving fields.


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