How HDAM and PHDAM records are stored
HDAM or PHDAM databases consist of two parts: a root addressable area and an overflow area.
The root addressable area contains root segments and is the primary storage area for dependent segments in a database record. The overflow area is for the storage of segments that do not fit in the root addressable area. You specify the size of the root addressable area in the relative block number (RBN) operand of the RMNAME parameter in the DBD statement. For PHDAM, you can also use the HALDB Partition Definition utility to specify the size of the root addressable area. You also specify the maximum number of bytes of a database record to be stored in the root addressable area by using the BYTES operand of the RMNAME parameter in the DBD statement. For PHDAM databases, you can use the HALDB Partition Definition utility to specify the maximum number of bytes in the root addressable area.
The following figure shows example SKILL database records.

The following figure shows how these records are stored in a HDAM or HIDAM database.

When the database is initially loaded, the root and each dependent segment are put in the root addressable area until the next segment to be stored will cause the total space used to exceed the amount of space you specified in the BYTES operand. At this point, all remaining dependent segments in the database record are stored in the overflow area.
In an HDAM or a PHDAM database, the order in which you load database records does not matter. The user randomizing module determines where each root is stored. However, as with all types of databases, when the database is loaded, all dependents of a root must be loaded in hierarchical sequence following the root.
To store an HDAM or a PHDAM database record, the randomizing module takes the root's key and, by hashing or some other arithmetic technique, computes an RBN or CI number and a RAP number within the block or CI. The module gives these numbers to IMS, and IMS determines where in the root addressable area to store the root. The RBN or CI tells IMS in which CI or block (relative to the beginning of the data set) the RAP will be stored. The RAP number tells which RAP in the CI or block will contain the address of the root. During load, IMS stores the root and as many of its dependent segments that will fit (based on the bytes operand) in the root addressable area.
When the database is initially loaded, it puts the root and segments in the first available space in the specified CI or block, if this is possible. IMS then puts the 4-byte address of the root in the RAP of the CI or block designated by the randomizing module. RAPs only exist in the root addressable area. If space is not available in the root addressable area for a root, it is put in the overflow area. The root, however, is chained from a RAP in the root addressable area.