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:

  1. There is a set of segments (record types) {R1, R2,…,Rn}.
  2. There is a set of relationships connecting all segments in one data structure diagram.
  3. There is no more than one relationship between any two segments Ri and Rj. Hence relationships need not be labeled.
  4. The relationships expressed in the data structure diagram form a tree with all arcs pointing towards leaves.
  5. 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:

  1. Any way you store a tree
  2. Linked List
  3. Sequential file (tree scanned via LNR, NLR, etc.)
  4. Table
  5. 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

  1. Amount of storage regarded
  2. Time needed to fetch a record
  3. ______next ‘’
  4. Time needed to insert
  5. ______update
  6. ______exhaustive reading
  7. ______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.