


The RECORD-POSITION construct allows you to refer to a data item by creating a numeric literal representing the location of the data item within a record.
General Format
RECORD-POSITION OF data-name
Syntax Rules
1. Data-name must refer to a data item with a level number of 01 through 50 or 77. Data-name may be qualified, but may not be subscripted or reference modified.
2. The RECORD-POSITION phrase is allowed anywhere a numeric literal data item may appear.
General Rules
1. The RECORD-POSITION phrase creates a numeric literal whose value is the character position of data-name within its record, as follows:
a) If data-name is a level 01 or 77 data item, then the value is "1".
b) Otherwise, the value is the character position of the start of data-name within its containing level 01 group item. Character positions start numbering at "1".
2. If data-name refers to a table item, the value is computed from the first occurrence of that item.
3. The format of the resulting literal is the same as a PIC 9(9) DISPLAY data item.
More: