COBOL Manual for TNS and TNS/R Programs
Data Fundamentals
HP COBOL Manual for TNS and TNS/R Programs—522555-006
4-23
Reference Modifiers
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.
•
Reference modifiers create a unique data item, which is a substring of the data
item referenced by identifier. The program handles this unique data item as
an elementary data item without the JUSTIFIED clause.
When identifier references an alphabetic data item, the unique data item has
the class and category alphabetic.
When identifier references a data item of any other category, the unique data
item has the class and category alphanumeric.
•
The unique data item created by reference modifiers can be used not only as a
sending item, but also as a receiving item—you can store a new value into it.