DMSII GROUP OCCURS

The following is an excerpt from a DMSII DASDL that shows a GROUP item that has an OCCURS clause.

SALES                   DATA SET
(
 PRODUCT-CODE           ALPHA (10);
 PRODUCT-NAME           ALPHA (20);
 SALES-HISTORY GROUP   OCCURS 5 TIMES %FIVE YEAR HISTORY
    (
    TOTAL-UNITS-SOLD        NUMBER (10);   %FOR THE YEAR
    YEARLY-SALES-AMOUNT     NUMBER (S12,2); %BY MONTH
    );

);
SH-PRODUCT-CODE-SET     SET OF SALES-HISTORY
   KEY IS
   (
   PRODUCT-CODE
   )
NO DUPLICATES,
INDEX SEQUENTIAL;

When this SALES data set is cloned into the relational database, it is mapped into the following tables:

Table 1 (primary table)

This table is named the same as the SALES DMSII data set, and it contains the key item and all non-OCCURS data items. Because the GROUP item has an OCCURS clause, none of the GROUP items are included in this table. Assuming there are five records in the DMSII data set, there are five rows in this relational database table.

sales  (table name)
product_code     product_name
------------     ------------
BC99992121       Widget
TR55553440       Mixer
HM44447322       Gadget
PP77778299       Twirler
DG22221163       SuperMix

Table 2 (secondary table)

This table is named: datasetname + GROUP_OCCURS_name

Assuming there are five records in the DMSII data set, there are 25 product codes in this relational database table. The main difference here is the addition of an index to denote the occurrence number of the item.

sales_sales_history (table name)

product_code   index1    total_units_sold   yearly_sales_amount
------------   ------    ----------------   -------------------
BC99992121          1            55543665          123456789.01
BC99992121          2            83746994          234567890.12
BC99992121          3            33847295          345678901.23
BC99992121          4            57483037          456789123.45
BC99992121          5            10947377          567891234.56
TR55553440          1            56722221          678912345.67
TR55553440          2            74838976          789123456.78
TR55553440          3            54793873          891234567.89
TR55553440          4            99048900          912345678.90
TR55553440          5            22308459          123456789.01
HM44447322          1            75032948          234567890.12
HM44447322          2            30750344          345678901.23
HM44447322          3            90570340          456789123.45
HM44447322          4            57948755          567891234.56
HM44447322          5            44874733          678912345.67
     .              .                   .                   .      
     .              .                   .                   .