Pathway/iTS SCREEN COBOL Reference Manual (G06.24+, H06.03+, Pathway/iTS 1.0+)
Data Division
Compaq NonStop™ Pathway/iTS SCREEN COBOL Reference Manual—426750-001
5-9
OCCURS Clause
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.
A data description entry with an OCCURS DEPENDING ON clause can be followed,
within its data description, only by descriptions of subordinate items. In other words,
only one table with a variable number of occurrences can appear in a single data
description, and the data items contained by the table must be the last data items in the
data description.
OCCURS max [ TIMES ]
OCCURS min TO max [ TIMES ] DEPENDING [ ON ] depend