The OCCURS clause eliminates the need for separate entries for repeated data items and supplies information required for the application of subscripts or indices.
or equal to
zero and integer-2 must be greater than
or equal to
integer-1.
In Format 2, if "integer-1
TO" is omitted, the default value one is assumed.
This restriction is removed.
This restriction is removed.
unless it
is to be indexed by an index defined for another table (see the section
Indexing in the chapter
Concepts of the COBOL Language)
.
The index-name identified by this clause is not defined elsewhere, and not being data, cannot be associated with any data hierarchy.
A data description entry that
contains Format 2 of the OCCURS clause can be followed, within that record
description, by data description entries which are not subordinate to it. When
the value of the data item referenced by data-name-1 is changed, the position
of data items following, but not subordinate to, the table is changed. The data
these items contain can be lost.
If the NOODOSLIDE Compiler directive is
set, all group items containing the table are considered as always having the
maximum number of occurrences, irrespective of the value of data-name-1 and
therefore the position of the data items following the table is not changed.
An OCCURS clause can be
specified for a data description subordinate to another item with a Format 2
OCCURS clause.
This restriction is removed.
If the ODOSLIDE Compiler
directive is set, data-name-1 must have a fixed location.
Index-name-1,
index-name-2, ... need not be unique and can be qualified by the data-name
which is the subject of this entry
.
, SORT
or USE FOR DEBUGGING. Further, if the subject of this entry is the name of a group item, then all data-names belonging to the group must be subscripted or indexed whenever they are used as operands, except as the object of a REDEFINES clause. (See the topics Subscripting, Indexing and Identifier in the chapter Concepts of the COBOL Language.)
This format specifies that the subject of this entry has a variable number of occurrences. The value of integer-2 represents the maximum number of occurrences and the value of integer-1 represents the minimum number of occurrences. This does not imply that the length of the subject of the entry is variable, but that the number of occurrences is variable.
The value of the data item referenced by data-name-1 must fall within the range of integer-1 through integer-2. Reducing the value of this data item makes the contents of data items, whose occurrence numbers now exceed the value of the data item referenced by data-name-1, unpredictable.
Table 1 specifies how storage is allocated for non-recursive programs. Table 2 specifies how storage is allocated for recursive programs.
Index-name Defined in | Index-name Allocated in | ||
---|---|---|---|
NOREENTRANT | REENTRANT (1) | REENTRANT (2) | |
working storage | working storage | working storage | thread-local |
thread-local | thread-local | thread-local | thread-local |
linkage | working storage | local storage | local storage |
Index-name Defined in | Index-name Allocated in | ||
---|---|---|---|
NOREENTRANT | REENTRANT (1) | REENTRANT (2) | |
working storage | working storage | working storage | thread-local |
thread-local | thread-local | thread-local | thread-local |
local storage | local storage | local storage | local storage |
linkage | local storage | local storage | local storage |