A hierarchical direct (HD) database is a database that maintains the hierarchical sequence of its segments by having segments point to one another (instead of by physically storing the segments in the hierarchical sequence).
HD databases are stored on direct-access devices in either a VSAM ESDS or an OSAM data set. In most cases, each segment in an HD database has one or more direct-address pointers in its prefix.
When direct-address pointers are used, database records and segments can be stored anywhere in the database.
After segments are inserted into the database, they remain in their original positions unless the segments are deleted or until the database is reorganized.
During database update activity, pointers are updated to reflect the hierarchical relationships of the segments.
HD databases also differ from sequentially organized databases because space in HD databases can be reused.
If part or all of a database record is deleted, the deleted space can be reused when new database records or segments are inserted.
HD databases access the root segments that they contain in one of two ways: by using a randomizing module or by using a primary index. HD databases that use a randomizing module are referred to as hierarchical direct access method (HDAM) databases. HD databases that use a primary index are referred to as hierarchical indexed direct access method (HIDAM) databases. HD databases can also be partitioned.
A partitioned HD database that uses a randomizing module to access its root segments is referred to as a partitioned HDAM (PHDAM) database.
A partitioned HD database that uses a primary index to access its root segments is referred to as a partitioned HIDAM (PHIDAM) database. PHDAM and PHIDAM databases, along with partitioned secondary index (PSINDEX) databases, are collectively referred to as High Availability Large Database (HALDB) type databases.
The storage organization in HD databases
Use a randomizing module and in HD databases that use a primary index is basically the same.
The primary difference is in how their root segments are accessed.
In HDAM or PHDAM databases, the randomizing module examines the root’s key to determine the address of a pointer to the root segment. In HIDAM or PHIDAM databases, each root segment’s storage location is found by searching the index.
In HIDAM databases, the primary index is a database that IMS™ loads and maintains. In PHIDAM databases, the primary index is a data set that IMS loads and maintains.
The advantage of a randomizing module is that the I/O operations that are required to search an index are eliminated. In PHDAM and PHIDAM databases, before IMS uses either the randomizing module or the primary index, IMS must determine which partition the root segments are stored in by using a process called partition selection.
You can have IMS perform partition selection by assigning a range of root keys to a partition or by using a partition selection exit routine.
The maximum possible size of HDAM, PHDAM, HIDAM, and PHIDAM databases is based on the number of data sets the database can hold and the size of the data sets. The maximum possible size of a data set differs depending on whether VSAM or OSAM is used and whether the database is partitioned.
DL/I calls that can be issued against HD databases All DL/I calls can be issued against HD databases.
When to use HDAM and PHDAM HDAM and PHDAM databases are typically used for direct access to database records.
When to use HIDAM and PHIDAM HIDAM and PHIDAM databases are typically used when you need both random and sequential access to database records and random access to paths of segment in a database record. What you need to know about HD databases Before looking in detail at how HD databases are stored and processed, you need to become familiar with pointers used in HD databases.
General format of HD databases and use of special fields
The way in which an HD database is organized is not particularly complex, but some of the special fields in the database used for things like managing space make HD databases seem quite different from sequentially organized databases.
How HDAM and PHDAM records are stored HDAM or PHDAM databases consist of two parts: a root addressable area and an overflow area.
When not enough root storage room exists If the CI or block specified by the randomizing module does not contain enough room to store the root, IMS uses the HD space search algorithm to find space. How HIDAM and PHIDAM records are stored A HIDAM database is actually composed of two databases.
One database contains the database records and the other database contains the HIDAM index.
HIDAM uses the index to get to a specific root segment rather than the root anchor points that HDAM and PHDAM use. Accessing segments The way in which a segment in an HD database is accessed depends on whether the DL/I call for the segment is qualified or unqualified. Inserting root segments
The way in which a root segment is inserted into an HD database depends on whether the database is HDAM, PHDAM, HIDAM, or PHIDAM. Inserting dependent segments After initial load, dependent segments are inserted into HD databases using the HD space search algorithm. Deleting segments When a segment is deleted in an HD database, it is physically removed from the database.
The space it occupied can be reused when new segments are inserted. Replacing segments Replacing segments in HD databases is straightforward as long as fixed-length segments are used. How the HD space search algorithm works
The general rule for inserting a segment into an HD database is to store the segment (whether root or dependent) in the most desirable block or CI. Locking protocols IMS uses locks to isolate the database changes made by concurrently executing programs.
Backup and recovery of HIDAM and PHIDAM primary indexes The backup and recovery of HD primary indexes differs depending on whether the database is a HIDAM or a PHIDAM database.