HELPLIB.HLB  —  COBOL  DATA_DIVISION, clauses  OCCURS
  The OCCURS clause defines tables and provides the basis for
  subscripting and indexing.  It eliminates the need for separate
  entries for repeated data items.

1  –  1format_table-size

  The OCCURS clause defines tables and provides the basis for
  subscripting and indexing.  It eliminates the need for separate
  entries for repeated data items.

  Format 1 -

   OCCURS table-size TIMES

      [ { ASCENDING  } KEY IS {key-name} ... ] ...
      [ { DESCENDING }                       ]

      [ INDEXED BY {ind-name} ... ]

1.1  –  table-size

  is an integer that specifies the exact number of occurrences of a
  table element.

1.2  –  key-name

  is the data-name of an entry that contains the OCCURS clause or an
  entry subordinate to it.  Key-name can be qualified.  Each key-name
  after the first must name an entry subordinate to the entry that
  contains the OCCURS clause.  The values in each key-name are the
  basis of the ascending or descending arrangement of the table's
  repeated data.

1.3  –  ind-name

  is an index-name. It associates an index with the table and allows
  indexing in table element references.

2  –  2format DEPENDING

  The OCCURS clause defines tables and provides the basis for
  subscripting and indexing.  It eliminates the need for separate
  entries for repeated data items.

  Format 2 -

   OCCURS min-times TO max-times TIMES DEPENDING ON depending-item

      [ { ASCENDING  } KEY IS {key-name} ... ] ...
      [ { DESCENDING }                       ]

      [ INDEXED BY {ind-name} ... ]

2.1  –  min-times

  is an integer that specifies the minimum number of occurrences of a
  table element.  Its value must be greater than or equal to zero.

2.2  –  max-times

  is an integer that specifies the maximum number of occurrences of a
  table element.  Its value must be greater than min-times.

2.3  –  key-name

  is the data-name of an entry that contains the OCCURS clause or an
  entry subordinate to it.  Key-name can be qualified.  Each key-name
  after the first must name an entry subordinate to the entry that
  contains the OCCURS clause.  The values in each key-name are the
  basis of the ascending or descending arrangement of the table's
  repeated data.

2.4  –  ind-name

  is an index-name.  It associates an index with the table and allows
  indexing in table element references.

2.5  –  depending-item

  is the data-name of an elementary unsigned integer data item.  Its
  value specifies the current number of occurrences.  Depending-item
  can be qualified.
Close Help