Identifying Coinciding OCCURS Clauses

In Relativity, identifying coinciding OCCURS clauses means identifying two or more separate OCCURS clauses in a record description entry that each specify the same number of occurrences and where the COBOL tables created by the OCCURS clauses can be thought of as really being a single COBOL table accessed by a single subscript item.

Records within COBOL data files often contain two or more data items having the clause OCCURS x TIMES, with x typically being the same number for both data items. A good example of this would be values broken down by month, with OCCURS 12 TIMES being attributed to each value recorded per month.

A relational database must contain only single-valued columns; therefore, Relativity's default behavior for a COBOL OCCURS clause is to derive one row in a relational table for each occurrence of the COBOL data item. For example, the data item QUANTITY-SOLD-PER-MONTH occurs 12 times in the FD would result in 12 rows in a relational table for each COBOL record.

This effect may not be desirable in the generated table, especially when you consider when two (or more) such data items are included in a relational table: each COBOL record produces the number of rows that is determined by multiplying the integers in the OCCURS clauses; if three data items within a COBOL data file are each associated with an OCCURS 12 TIMES clause, then the three data items produce 12 x 12 x 12 or 1,728 rows in a relational table.

The identification of data items having coinciding OCCURS characteristics enables Relativity to generate 12 rows containing columns for the three selected data items.