In COBOL, an OCCURS clause specifies a repeating data item or group of data items. The relational model does not include the
concept of repeating items except as rows of a relational table, thus providing a simpler (or "normalized") data model. Relativity
provides several techniques for handling the mapping of repeating data items in COBOL to normalized relational tables.
The following techniques may be used in any combination to properly specify the treatment of the OCCURS clause by Relativity:
- Coinciding OCCURS: - two or more separate OCCURS clauses, each specifying the same number of occurrences can sometimes be thought of as being
a single COBOL table accessed by a single subscript item. Marking these OCCURS as coinciding produces an effect similar to
this in the relational table. See
Identifying Parallel OCCURS Clauses for more information.
- Multiple Rows vs. Flattening: - the default behavior of Relativity is to map repeating items to multiple rows. There are instances, however, in which each
occurrence defined by an OCCURS clause has unique significance, and as such the default behavior is not desired. These cases
should be identified and, at table definition time, separate columns can be added for one, some, or all occurrences by binding
the subscript item associated with the OCCURS clause to one or more specific occurrences. This technique is sometimes called
flattening the OCCURS. For more details, see
Flattening OCCURS.
- Unused Occurrences Elimination: - unused occurrences resulting from an OCCURS clause should not become rows in a relational table. Correctly eliminating
unused occurrences can provide a significant boost in the performance of Relativity. For more information, see
Eliminating Unused Occurrences.