The OCCURS Clause

The OCCURS clause eliminates the need for separate entries for repeated data items and supplies information required for the application of subscripts or indices.

General Formats for Format 1


*

General Formats for Format 2

OCCURS Format 2

General Formats for Format 3


*

Directives

  1. In addition to Compiler directives which provide flagging and modify the reserved word list, the following directives may impact either the syntax or the semantics described in this section.
    • ODOOSVS – requests OS/VS COBOL compatible processing of the OCCURS DEPENDING ON clause.
    • ODOSLIDE – controls the processing of nested OCCURS DEPENDING ON clauses and fixed data following an OCCURS DEPENDING ON clause.
    • REENTRANT – allows a program to be used in a multi-threaded environment.

Syntax Rules

  1. Where both integer-1 and integer-2 are used, integer-1 must be greater than

    ANS85OSVS or equal to

    zero and integer-2 must be greater than

    OSVSVSC2 or equal to

    integer-1.

    OSVSVSC2MF In Format 2, if "integer-1 TO" is omitted, the default value one is assumed.

  2. The data description of data-name-1 must describe an integer.
  3. Data-name-1, data-name-2, data-name-3, ... can be qualified.
  4. Data-name-2 must be either the name of the entry containing the OCCURS clause or the name of an entry subordinate to the entry containing the OCCURS clause.

    OSVS This restriction is removed.

  5. Data-name-3, and so on, must be the name of an entry subordinate to the group item which is the subject of this entry.

    OSVS This restriction is removed.