How secondary indexing affects your program
One instance of using a secondary index occurs when an application program needs to select database records in a sequence other than that defined by the root key.
IMS stores root segments in the sequence of their key fields. A program that accesses root segments out of the order of their key fields cannot operate efficiently.
You can index any field in a segment by defining an XDFLD statement for the field in the DBD for the database. If the Get call is not qualified on the key but uses some other field, IMS must search all the database records to find the correct record. With secondary indexing, IMS can go directly to a record based on a field value that is not in the key field.
For more information about secondary indexes and examples, see IMS Version 15.3 Database Administration.