Eliminating Unused Occurrences

Unused occurrences associated with an OCCURS clause should not become rows in a relational table. If, for example, you have a COBOL data file with 10,000 records, each of which contains an OCCURS 20 TIMES clause and you do not eliminate the unused occurrences, the result of the normalization would be a table containing 200,000 rows. If all occurrences in every record are active, then this is the necessary size of the table. However, it is often the case that the OCCURS clause specifies an upper bound on the number of active occurrences, not the actual number of active occurrences. The performance of Relativity in such cases can be significantly improved by eliminating the unused occurrences.

There are three alternatives for dealing with unused occurrences of a repeating data item:

  1. Use a variable number of occurrences within the COBOL program by specifying the OCCURS clause with the DEPENDING ON phrase. Relativity will then only use the active occurrences indicated by the value of the data item specified by the DEPENDING ON phrase.
  2. Use an existing data item in the record that specifies the number of active occurrences; that is, an implicit Occurs Depending On variable, to limit the number of occurrences considered by Relativity. See Identifying Implicit OCCURS DEPENDING ON for more information.
  3. Use table filters to discard occurrences with null values (for example, spaces or zeroes might indicate null values). See Defining Table Filters for more information.