COBOL Manual for TNS and TNS/R Programs

Data Division
HP COBOL Manual for TNS and TNS/R Programs522555-006
7-84
OCCURS Clause for Variable-Size Tables
max
is an integer literal that specifies the maximum number of table elements.
depend
is an integer data item that controls the size of the table. As depend increases or
decreases, the number of table elements increases or decreases. When the table
size decreases, elements beyond the element whose ordinal position is specified
by the new value of depend are lost—even if the next statement increases the
table to include them. When the table grows, you must assign values to the new
elements prior to using them.
key-order
determines whether table elements are arranged in ascending or descending order
of key values.
key
is either the name of the entry containing the OCCURS clause or the name of
an entry subordinate to the entry containing the OCCURS clause.
index
is a name for compiler-created item used to select an element from the table.
Each index must be unique in the program because you cannot qualify it.
Usage Considerations:
See the usage considerations for OCCURS Clause for Fixed-Size Tables.
Depending Item
The depending item (depend in the syntax diagram) must reference an integer
numeric data item that is capable of containing the value of max. The storage
space associated with the depending item cannot be contained within or overlap
the storage space associated with the table whose occurrences it controls;
therefore, the depending item cannot be described as a subordinate of the
variable-occurrence data item. If the table is external, the depending item must
also be external.
ASCENDING
DESCENDING KEY IS
key
VST105.vsd