Database is a group of data elements organized to meet the requirements of one or more applications. Data elements are organized in a hierarchical structure. All IMS databases are made up of one or more hierarchies or inverted tree structures. Some data elements are dependent on others.
The hierarchical data base tree structure is shown in the figure below for customer database.
A DL/I data base record consists of clusters of data fields, which are called SEGMENTS. A segment represents the smallest unit of information that DL/I transfers to and from the program in an I/O operation.
Each segment consists of one or more data fields. A single segment type or multiple segment types can be defined at each level of the data base. The single segment at top of hierarchy - the one from which all the other segments eventually derive is called ROOT segment. Only one root per data base record.
In the customer data base example, there are four levels and there are multiple segments at some levels. DL/I allows to implement structures that are more complex in nature, with 15 levels and 255 different segment types in a data base.
Segment type is simply a category of data.
Segment occurrence is one specific segment of a particular type containing user data. . Within a database, there is only one of each segment type - it’s part of the database’s definition-but there can be an unlimited number of occurrences of each segment type.
In customer data base example there are seven segment types and each is represented by one of the boxes. There are three occurrences of the customer segment type in the above example (C1, C2, C3) which means that three customers information is stored in the data base.
The terms Parent and Child are used to describe the relation ships between segment types.
Any segment type having one or more segment types directly below it is called a Parent
Any segment type having a segment type directly above it is called a Child.
For example in the Customer data base Receivable segment type (R1) is a parent, and Payment (P1, P2), Adjustment (A1, A2), Line Item (L1, L2) Segment types are its Children. However the Receivable segment type is also a child of Ship-to Segment (S1).
All segments in a data base record other than the root segment are called Dependent Segments.
For example Line-Item segment is dependent on Receivable segment. A particular Payment segment occurrence cannot exist unless there is a Receivable segment occurrence above it in the data base. But it is valid to have a Receivable segment occurrence (R2) that does not have any of the Payment, Adjustment, Line-item segment occurrences below it.
All occurrences of a particular segment type under a single parent segment occurrence are called twins. For example a particular Receivable (R1) has 2 occurrences of adjustment segment type (A1, A2), which are called twins. However, receivable A2, A3 are not twins, because they have different segment occurrences as parents.
Set of all twins dependent on a particular parent can be called as Twin Chain. In the Customer data base P1, P2, A1, A2, L1, L2 can be called as Twin Chain, as because all the segment occurrences have the parent same as R1.
A data base record consists of a single occurrence of the root segment plus all its dependent segment occurrences. In standard file processing, a record is the unit of data that programs operate upon. Under DL/I, that unit is the segment. A single data base record typically has many segment occurrences.
To retrieve a data base record all the segments (Root and dependent) and segment occurrences will be retrieved in a specific sequence which is called as Hierarchical Path. The path is an imaginary line that starts at the root segment, passes through all segment types at intermediate levels in the hierarchy. The path followed is Top - down and Left to Right.
The hierarchical path and data base record can be very well understood with the following example. In the Customer data base there are three data base records. They are,
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on IBMMainframer Community!