Creating an index segment

As each root is stored in a HIDAM or PHIDAM database, IMS creates an index segment for the root and stores it in the index database or data set.

The index database consists of a VSAM KSDS. The KSDS contains an index segment for each root in the database or HALDB partition. When initially loading a HIDAM or PHIDAM database, IMS will insert a root segment with a key of all X'FF's as the last root in the database or partition.

The format of an index segment is shown in the following figure.

Figure 1. Format of an index segment
Index segment has two portions: prefix and data. In prefix is the following: delete byte and address of the root segment (4 bytes). In the data portion is the key of the root segment.

The prefix portion of the index segment contains the delete byte and the root's address. The data portion of the index segment contains the key field of the root being indexed. This key field identifies which root segment the index segment is for and remains the reason why root segments in a HIDAM or PHIDAM database must have unique sequence fields. Each index segment is a separate logical record. The following figure shows the index database that IMS would generate when the two database records in Figure 1 were loaded.

Figure 2. HIDAM or PHIDAM index databases
Pointers in the index point to the root segments stored in the databases.