Embedded Data Sets

An embedded data set is a DMSII representation of a hierarchical relationship or tree structure. When a DMSII data set contains another data set as an item, that data set is called an embedded data set. The data set in which it is declared is called the parent of the embedded structure. You can think of the embedded data set as the "child" of the "parent" data set.

To represent this parent-child relationship in a relational database, the DATABridge Client uses a foreign key that points to the parent data set. This foreign key is represented by the value in the parent_aa column in the table that corresponds to the embedded data set. The parent_aa column holds the parent record’s key.

DMSII DASDL Showing an Embedded Data Set

The following is an excerpt from a DMSII DASDL that shows how an embedded data set is defined.

   PARENT-FAT-NAME          ALPHA (30);
   PARENT-MOT-NAME          ALPHA (30);
   PARENT-FAT-BDATE         NUMBER (06);
   PARENT-MOT-BDATE         NUMBER (06);
   FILLER                   SIZE (06);
   CHILD                    DATA SET;
      CHILD-NAME            ALPHA (30);
      CHILD-STATUS          ALPHA (11);
      CHILD-BDATE           NUMBER (06);
      CHILD-GENDER          FIELD
         CHILD-MALE         BOOLEAN;
         CHILD-FEMALE       BOOLEAN;
      CHILD-FILLER          FIELD (01);

Resulting Tables

The following examples are for Microsoft SQL Server.

Ignoring any set definition, the resulting relational database tables are as follows:

  • Genealogy (the parent data set is cloned to its own primary table)
  • Child (the embedded data set is cloned to its own secondary table with a pointer to its parent table)

    Parent Table

    genealogy (table name)
    my_aa               char(12),
       parent_fat_name     char(30),
       parent_mot_name     char(30),
       parent_mot_maiden   char(30),
       parent_fat_bdate    int,
       parent_mot_bdate    int
    where the my_aa column is a unique key for the record derived from the DMSII AA value of this record.

    Child Table

    child (table name)
       my_aa   char(12), — child table’s key
       parent_aa          char(12), — foreign key of parent table
       child_name         char(30),
       child_status       char(11),
       child_bdate        int,
       child_male         bit,
       child_female       bit,
       child_filler       smallint