Hierarchical databases work on the relationships between two or more segments. The following example shows how segments are related to each other in the IMS database structure.
Root Segment
Points to note −
- The segment that lies at the top of the hierarchy is called the root segment.
- The root segment is the only segment through which all dependent segments are accessed.
- The root segment is the only segment in the database which is never a child segment.
- There can be only one root segment in the IMS database structure.
- For example, 'A' is the root segment in the above example.
Parent Segment
Points to note −
- A parent segment has one or more dependent segments directly below it.
- For example, 'A', 'B', and 'E' are the parent segments in the above example.
Dependent Segment
Points to note −
- All segments other than the root segment are known as dependent segments.
- Dependent segments depend on one or more segments to present complete meaning.
- For example, 'B', 'C1', 'C2', 'D', 'E', 'F1' and 'F2' are dependent segments in our example.
Child Segment
Points to note −
- Any segment having a segment directly above it in the hierarchy is known as a child segment.
- Each dependent segment in the structure is a child segment.
- For example, 'B', 'C1', 'C2', 'D', 'E', 'F1' and 'F2' are child segments.
Twin Segments
Points to note −
- Two or more segment occurrences of a particular segment type under a single parent segment are called twin segments.
- For example, 'C1' and 'C2' are twin segments, so do 'F1' and 'F2' are.
Sibling Segment
Points to note −
- Sibling segments are the segments of different types and the same parent.
- For example, 'B' and 'E' are sibling segments. Similarly, 'C1', 'C2',and 'D' are sibling segments.
Database Record
Points to note −
- Each occurrence of the root segment, plus all the subordinate segment occurrences make one database record.
- Every database record has only one root segment but it may have any number of segment occurrences.
- In standard file processing, a record is a unit of data that an application program uses for certain operations. In DL/I, that unit of data is known as a segment. A single database record has many segment occurrences.
Database Path
Points to note −
- A path is the series of segments that starts from the root segment of a database record to any specific segment occurrence.
- A path in the hierarchy structure need not be complete to the lowest level. It depends on how much information we require about an entity.
- A path must be continuous and we cannot skip intermediate levels in the structure.
- In the following figure, the child records in dark grey color show a path which starts from 'A' and goes through 'C2'.
No comments:
Post a Comment