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

Topics:
Reference Modifier Syntax
Rules for Reference Modifiers
Reference Modifier Syntax
identifier
is the name of a data item with USAGE DISPLAY. If it is qualified or subscripted, the reference
modifier appears after the qualifiers or subscripts.
leftmost-character-position
is an arithmetic expression. Its value must be a positive nonzero integer less than or equal to
the number of characters in identifier; it represents the leftmost character of the portion
of identifier you are selecting.
length
is an arithmetic expression. Its value must be a positive, nonzero integer; it represents the size
of the portion of identifier you are selecting. The value of the expression
(leftmost-character-position + length ) - 1
must be less than or equal to the number of characters in identifier.
If length is absent, the defined item begins with leftmost-character-position and
ends with the last character of identifier; thus the length of the defined item is
(data-name-length - leftmost-character-position ) + 1
where data-name-length is the length of identifier.
Rules for Reference Modifiers
These rules for reference modifiers apply directly if the data item referenced by identifier is
described as alphabetic or alphanumeric.
If the data item is described as numeric, numeric edited, or alphanumeric edited, it is operated
upon for purposes of reference modification as if it were redefined as an alphanumeric data item
of the same size as the data item referenced by identifier. Any numeric item must be USAGE
DISPLAY.
If the data item is described as national, the leftmost-character-position and length
variables refer to the 2-byte pairs representing the characters, not to individual bytes. In all other
respects, these rules for reference modifiers given apply directly:
Reference modifiers for an operand are evaluated immediately after evaluation of any subscripts
that are specified for that operand. If no subscripts are specified for the operand, the reference
modifiers are evaluated at the time subscripting would be evaluated if subscripts had been
specified.
Each character of the data item referenced by identifier is assigned an ordinal number,
incrementing by one from the leftmost position to the rightmost position. The leftmost position
is assigned the ordinal number one. If identifier is described with a SIGN SEPARATE
clause, the sign position within that data item is assigned an appropriate ordinal number.
92 Data Fundamentals