Flattening OCCURS

Relativity's normal treatment of a COBOL OCCURS clause is to derive one row in a relational table for each occurrence of the repeating data item. However, there may be situations in which it is desirable to treat repeating data items as one or more columns, rather than as multiple rows. An example situation would be one in which the months of a year need to display as twelve columns in a single row rather than as a separate row for each month. This is called "flattening" the OCCURS.

To achieve this behavior in the table, it is necessary to prepare for handling repeating data items during the augmentation phase. The necessary preparation is to create subscript conditions.

The process is similar to that of creating a standard condition item, but you create an 88-level condition for each occurrence in the OCCURS limit, giving each condition a unique (subscripted) value - in the 'months' example given above, that would be 12 separate 88-level conditions, with values 1-12.

Tip: A special procedure exists to aid the creation of multiple conditions: use the Serialize option to automatically create multiple conditions based on the OCCURS limit.

Once you have created the necessary subscript conditions, when you add the subscripted data item to a table definition, you are prompted to bind the columns and the conditions - see Binding a Column to a Subscript.