Previous Topic: Root Segments and Database RecordsNext Topic: Defining Segments


Hierarchical Access Path

A DL/I Hierarchy

The basic parent/child structure is hierarchical in that it requires traversing higher levels to reach a specific lower level. In other words, to reach a given child segment occurrence, you must go from the root segment occurrence through all the intermediate parent segment occurrences. This path is known as a hierarchical access path. Hierarchical paths require that you traverse a structure in a top-to-bottom, left-to-right manner. There is a maximum of 15 levels (that is, 14 parent segments, including the root) in a DL/I hierarchical path.

The illustrations on the next few pages show different representations of the same DL/I hierarchy.

Physical Parent/Child Relationships

The illustration below illustrates the physical parent/child relationships among the segments. It is these physical relationships that define the hierarchy. The names of the segments are SEGA, SEGB, SEGC, and SEGD.

Figure 6. Physical segment relationships

DBD Source Statements For the Hierarchy

The sample below shows the Database Description (DBD) source statements used to define the hierarchy and the parent/child relationships among the segments.

 DBD      NAME=DBD1,ACCESS=HDAM,RMNAME=(DLZHDC20,2,13000,4500)
 DATASET  DD1=DBD1HDAM,DEVICE=3350,BLOCK=4096,SCAN=3
 SEGM     NAME=SEGA,BYTES=31,PTR=H,PARENT=0
 FIELD    NAME=(FIELDA,SEQ,U),BYTES=21,START=1
 FIELD    NAME=FIELDB,BYTES=10,START=22
 SEGM     NAME=SEGB,BYTES=30,PTR=H,PARENT=SEGA
 FIELD    NAME=(FIELDC,SEQ,U),BYTES=30,START=1
 SEGM     NAME=SEGC,BYTES=30,PTR=H,PARENT=SEGB
 FIELD    NAME=(FIELDD,SEQ,U),BYTES=10,START=1
 FIELD    NAME=FIELDE,BYTES=20,START=11
 SEGM     NAME=SEGD,BYTES=60,PTR=H,PARENT=SEGB
 FIELD    NAME=(FIELDF,SEQ,U),BYTES=10,START=1
 FIELD    NAME=FIELDG,BYTES=50,START=11
 DBDGEN
 FINISH
 END

Figure 7. DBD source statements for sample hierarchy

Hierarchy with Database Records

The illustration below shows a hierarchy with database records

Note that in the A1 record, segment SEGC has three occurrences. In the A2 record, segment SEGD has two occurrences. The hierarchical path to the D2b occurrence is by way of the following occurrences: A2, B2, C2, D2a (from top to bottom and left to right).

Figure 8. Hierarchy with database records