COBOL Manual for TNS/E Programs (H06.03+)
Data Fundamentals
HP COBOL Manual for TNS/E Programs—520347-003
4-21
Reference Modifiers
Number and Range of Subscripts
HP COBOL supports subscripting of up to 7 dimensions.
The lowest legitimate subscript value is 1, which selects the first element of a table.
The next sequential elements of the table are selected by subscripts whose values are
2, 3, and so on. The highest subscript value, in any particular case, is the maximum
number of elements in the table. Any higher subscript is erroneous, and can cause an
error.
You can use the directive CHECK, with a level-number greater than 1, to include code
in the resulting program to perform range checking during execution. If the program
attempts to use a subscript that is out of range, the range checking routine reports a
fatal error.
If you do not include a CHECK directive, the compilation produces a program in which
subscript-out-of-range errors go undetected. These undetected errors can cause
corruption of other data, producing errors that can be difficult to locate, even with a
symbolic debugger.
Reference Modifiers
Reference modifiers allow you to reference an arbitrary portion of a data item’s value,
which is important in some applications. With reference modifiers, you define an
elementary item by specifying a leftmost character position within a data item and a
length for the new item. 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.
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.
identifier
)
leftmost-character-position
length
(
:
VST008.vsd










