HDAM, PHDAM, HIDAM, and PHIDAM databases
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 that 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 following figure compares a logical view of an HDAM database with the logical view of a PHDAM database.

The following figure compares a logical view of a HIDAM database with the logical view of a PHIDAM database.
