Hierarchical Model (DL/I Model)
Field
Segment
Database record (type)
Database
ONLY ONE TOO MANY RELATIONSHIPS ARE ALLOWED
The hierarchical data model has the following characteristics:
- There is a set of segments (record types) {R1, R2,…,Rn}.
- There is a set of relationships connecting all segments in one data structure diagram.
- There is no more than one relationship between any two segments Ri and Rj. Hence relationships need not be labeled.
- The relationships expressed in the data structure diagram form a tree with all arcs pointing towards leaves.
- Each relationship is 1:N, and it is total – that is for every Rj segment occurrence, there is exactly one Ri segment occurrence connected to it, if Ri is the parent of Rj in the definition tree.
Storage structures for hierarchical database:
- Any way you store a tree
- Linked List
- Sequential file (tree scanned via LNR, NLR, etc.)
- Table
- Children treated as twins
Storage Structures of IMS:
HSAM: Sequential File, LNR Traversal
H1SAM: Root indexed (children sequential)
HDAM: Root hashed (children pointers)
H1DAM: Root indexed (children pointers)
Flat files
Non flat files
Inverted lists
Trees
Link List
Table
LNR/NLR/LRN, etc.
PTRs in Pascal
Networks
Link List
Quantitative Measures
Space Update Retrieval
- Amount of storage regarded
- Time needed to fetch a record
- ______next ‘’
- Time needed to insert
- ______update
- ______exhaustive reading
- ______reorganize
IMS – DL/I QUERY LANGUAGE FOR HIERARCHICAL DATABASE
GET UNIQUE GU
GET NEXT GN
GET NEXT within GNU
PARENT
GET HOLD UNIQUE GHU
GET HOLD NEXT GHN
GET HOLD NEXT within GHNP
PARENT
GU A
B
This will cause 2 to go in working stage
GU A
B (=3)
This will cause 3 to go in working storage
GU A
B
GN
This will cause 6 to go in working storage
GU A
GN B Þ 2 in working storage
GNP Þ 6 in working storage
GNP Þ 7 in working storage
GNP Þ End of data
GU A
B
GNP C Þ 6 in working storage
GNP C Þ 7 in working storage
GNP C Þ End of data
GU A
GNP B Þ 2 in working storage
GNP B Þ 3 in working storage
GNP B Þ End of data
GU A
B
C Þ 6 in working storage
GN C Þ 7 in working storage
GN C Þ 8 in working storage
GN C Þ 9 in working storage
GN C Þ 10 in working storage
GU A
B
C Þ 6
GN Þ 7
GN Þ 3
GN Þ 8
GN Þ 9
GN Þ 10
GN Þ 4
UPDATE:
GHU A (KA = 1)
B (KB = 3)
Change KB to 14
REPL
Þ
DELETE
GHU A (KA = 1)
D (KA = 5)
DLET
ð will delete 5 and everything below it
(i.e., 12, 13,…,19).
INSERT
Create a new B segment in the working area (by using host language).
INSERT A (KA = 1)
B
If value of key of B < 2, it will be inserted on the left of 2.