Format 2: SET for adjusting indexes

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

Format 2: SET statement for adjusting indexes

Read syntax diagramSkip visual syntax diagramSETindex-name-3UP BYDOWN BYidentifier-3integer-2

The receiving field is an index specified by index-name-3. The index value both before and after the SET statement execution must correspond to an occurrence number in an associated table.

The sending field can be specified as identifier-3, which must be an elementary integer data item, or as integer-2, which must be a nonzero integer. identifier-3 cannot be a windowed date field.

When the format-2 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. 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.

If index-name-3 is for 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, then index-name-3 cannot contain a value that corresponds to an occurrence number of its associated table.

For more information about complex OCCURS DEPENDING ON, see Complex OCCURS DEPENDING ON in the COBOL for Linux® on x86 Programming Guide.