Pathway/iTS SCREEN COBOL Reference Manual (H06.10+, J06.03+)
Data Division
HP NonStop Pathway/iTS SCREEN COBOL Reference Manual—426750-003
5-9
OCCURS Clause
OCCURS Clause
The OCCURS clause defines tables and other sets of repeating items, thus eliminating
the need for separate item entries. These tables can be a fixed number of elements or
can vary within given limits. An OCCURS clause cannot be used in an 01 level entry.
Format 1 (for Fixed Length Tables) is:
max
is an integer that represents the number of elements in the table.
Format 2 (for Variable Length Tables) is:
min
is an integer that represents the smallest number of elements in the table at any
time. The integer must be zero or greater and less than or equal to
max
.
max
is an integer that represents the greatest number of elements the table can have at
any time.
depend
is an integer data item that controls the size of the table. As the value of the
depend
item increases or decreases, the number of elements in the table
increases or decreases. When the table size decreases, those elements beyond
the new
depend
limit are lost even if the next statement increases the table to
include them. When the table size increases, you must assign values to the new
elements before using them.
The following example illustrates the OCCURS clause:
01 table-group.
02 activity-count PIC 99.
02 activity-table OCCURS 10 TO 20 TIMES
DEPENDING ON activity-count.
05 activity-entry PIC 999.
When using the data name that represents a table item, you must use subscripts to
access the item. You can use the data name without subscripts only when you want
the entire table (for example, in a MOVE statement). If the data name is a group item,
you must use subscripts for all items belonging to the group whenever they are used
as operands. Subordinate data names used as objects of a REDEFINES clause are
not considered operands and, therefore, cannot be subscripted.
OCCURS
max
[ TIMES ]
OCCURS
min
TO
max
[ TIMES ] DEPENDING [ ON ]
depend










