COBOL Manual for TNS and TNS/R Programs
Data Division
HP COBOL Manual for TNS and TNS/R Programs—522555-006
7-83
OCCURS Clause for Variable-Size Tables
These identifiers specify elements of the table VEHICLE in Example 7-17:
MODEL (3)
STYLE OF MODEL (3, 11)
COLOR OF STYLE OF MODEL (3, 11, 14)
OCCURS Clause for Variable-Size Tables
The OCCURS clause with a DEPENDING phrase defines a variable-size table.
min
is an integer literal that specifies the minimum number of table elements. Its value
is in the range 0 through max.
Example 7-17. Fixed-Size Table
01 MY-TABLE-RECORD.
02 MY-TABLE OCCURS 100 TIMES
ASCENDING KEY IS FIRST-ITEM.
INDEXED MY-INDEX
05 FIRST-ITEM.
08 FIRST-A PICTURE 99.
08 FIRST-B.
10 FIRST-B-1 PICTURE 99.
10 FIRST-B-2 PICTURE 99.
05 SECOND-ITEM PICTURE X(6).
01 VEHICLE.
03 MODEL OCCURS 9 TIMES.
05 STYLE OCCURS 12 TIMES.
07 COLOR OCCURS 15 TIMES PICTURE 9(10).
05 LOCATION PICTURE X(25).
DEPENDING
min
TO
max
TIMES
ON
depend
INDEXED
BY
index
key-order
OCCURS
VST106.vsd