Previous Topic: ExamplesNext Topic: Field Name Support


Position Specification

The position specification rules are as follows:

Actual position

0 – 32760, where 0 signifies all record positions and 1 – 32760 is the actual position in the input or output record in which the keyword is operating.

You cannot reference an actual position that is greater than the defined maximum record's length.

Relative position

-nnn or +nnn

There are two separate relative positions: the scan relative position, and the move relative position. Both relative positions are maintained separately and are either added to (+) or subtracted from (-) when a scan-length is specified or a MOVE action is performed.

The scan relative position references the input record, and is set to position 1 after each record READ. The scan relative position remains at position 1 until an IF, AND, OR, SELMEMIF, SELRECIF, SKIPRECIF, ACCUM, CHANGE, EDIT, MOVE, or REPLACE keyword specifically selects a position using the scan-length parameter. When that happens, the scan relative position resets to the leftmost byte of the data selected by the scan. If the scan-length parameter is the same size of the data or from-data value, no scanning is done and the scan relative position remains unchanged.

The move relative position references the move output record buffer and is set to record position 1 after the first input record is read and after each WRITE. The move relative position remains at position 1 until a MOVE action is performed. Once a MOVE action is performed the new move relative position is computed by adding the current move relative position to the to-position relative value plus the length value. If the to-position is an actual position and not a relative position, the new move relative position is the actual position.

You cannot use relative positioning to select an input record location or move output record location that computes to less than 1 or greater than the defined maximum record length for the file.