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.

When insufficient space exists in the specified CI or block to store the root, the algorithm finds the closest available space to the specified CI or block. When space is found, the address of the root is still stored in the specified RAP in the original block or CI generated by the randomizing module.

If the randomizing module generates the same relative block and RAP number for more than one root, the RAP points to a single root and all additional roots with the same relative block and RAP number are chained to each other using physical twin pointers. Roots are always chained in ascending key sequence. If non-unique keys exist, the ISRT rules of FIRST, LAST, and HERE determine the sequence in which roots are chained. All roots chained like this from a single anchor point area are called synonyms.

How HDAM and PHDAM records are stored shows two HDAM or PHDAM database records and how they appear in storage after initial load. In this example, enough space exists in the specified block or CI to store the roots, and the unique relative block and RAP numbers for each root generated by the randomizing module. The bytes parameter specifies enough space for five segments of the database record to fit in the root addressable area. All remaining segments are put in the overflow area. When HDAM or PHDAM database records are initially loaded, dependent segments that cannot fit in the root addressable area are simply put in the first available space in the overflow area.

Note how segments in the database record are chained together. In this case, hierarchical pointers are used instead of the combination of physical child/physical twin pointers. Each segment points to the next segment in hierarchical sequence. Also note that two RAPs were specified per CI or block and each of the roots loaded is pointed to by a RAP. For simplicity, How HDAM and PHDAM records are stored does not show the various space management fields.

An HDAM or PHDAM segment in storage consists of a prefix followed by user data. The first byte of the prefix is the segment code, which identifies the segment type to IMS. This number can be from 1 to 255. The segment code is assigned to the segment type by IMS in ascending sequence, starting with the root segment and continuing through all dependents in hierarchical sequence. The second byte of the prefix is the delete byte. The third field in the prefix contains the one or more addresses of segments to which this segment is pointing. In this example, hierarchical forward pointers are used. Therefore, the EXPR4 segment contains only one address, the address of the NAME3 segment.