Data Definition Language (DDL) Reference Manual

Definition Attributes
Data Definition Language (DDL) Reference Manual529431-004
6-21
OCCURS
These statements apply to both the OCCURS clause and the OCCURS DEPENDING
ON clause except as explained in OCCURS DEPENDING ON on page 6-23:
OCCURS cannot be specified for the first element of a RECORD or DEFINITION
statement. OCCURS can be specified only at level number 02 or greater.
A field that is described with an OCCURS clause or that is part of a group
described with an OCCURS clause cannot have a VALUE clause unless the
VALUE is associated with a level-88 condition-name clause.
A field or group described with an OCCURS clause cannot be specified as a key
field in a RECORD statement.
OCCURS clauses can be nested. COBOL allows seven levels of nested OCCURS
clauses.
When OCCURS clauses are nested, a separate subscript is associated with each
level of nesting; the subscripts are written in order from most inclusive to least
inclusive.
The form of the subscript depends on the language. For example, COBOL
encloses subscripts in parentheses, and pTAL or TAL encloses them in brackets.
Subscript bounds depend on the language accessing the data:
°
For Pascal (on D-series systems), COBOL, and FORTRAN, the subscript
bounds are implicitly 1 and max.
°
For C and TACL, the subscript bounds are implicitly 0 and max -1.
°
The values of pTAL, TAL, or Pascal subscripts depend on the TALBOUND or
PASCALBOUND command. TALBOUND 0 or PASCALBOUND 0 causes the
subscript bounds to be 0 and max - 1. TALBOUND 1 or PASCALBOUND 1
causes the subscript bounds to be 1 and max.
The DDL compiler compiles the TALBOUND and PASCALBOUND setting (0 or
1 for each) to the OCCURS definition. You can change this value only by
replacing the definition.
COBOL output for the INDEXED BY attribute is the direct translation of the
attribute.
If you specify an index name in the OCCURS clause, do not specify USAGE IS
INDEX for the field of that name, because COBOL requires that all index names be
unique throughout a program. The DDL compiler checks for the uniqueness of an
index name you specify in the INDEXED BY attribute.
A group can be repeated with an OCCURS clause, as in Example 6-18 on
page 6-22.