Creating secondary indexes
Secondary indexes are indexes that process a segment type in a sequence other than the one that is defined by the segment's key. A secondary index can also process a segment type based on a qualification in a dependent segment.
The following database types support secondary indexes:
- HISAM
- HDAM
- PHDAM
- HIDAM
- PHIDAM
- DEDB
- The purpose of secondary indexes
Secondary indexing provides a way to meet the different processing requirements of various applications. Secondary indexing allows you to have an index based on any field in the database, not just the key field in the root segment. - Characteristics of secondary indexes
Secondary indexes can be used with HISAM, HDAM, PHDAM, HIDAM, DEDB, and PHIDAM databases. - Segments used for secondary indexes
To set up a secondary index, three types of segments must be defined to IMS: pointer, target, and source segments. - How secondary indexes restructure the hierarchy of databases
When an application program accesses a database through a secondary index, the database records are processed in an alternative sequence. - How a secondary index is stored
Secondary index databases contain root segments only. - Format and use of fields in a pointer segment
Like all segments, the pointer segment has a prefix and data portion. - Making keys unique using system related fields
If creating unique keys by keeping additional information from the source segment in the subsequence field of the pointer segment does not work for you, there are two other ways to force unique keys, both of which use an operand in the FIELD statement of the source segment in the DBD. - How sparse indexing suppresses index entries
When a source segment is loaded, inserted, or replaced in the database, DL/I automatically creates or maintains the pointer segment in the index. This happens automatically unless you have specified that you do not need certain pointer segments built. - How the secondary index is maintained
When a source segment is inserted, deleted, or replaced in the database, IMS keeps the index current regardless whether the application program performing the update uses the secondary index. - Processing a secondary index as a separate database
Because they are actual databases, secondary indexes can be processed independently. - Sharing secondary index databases
An index database can contain up to 16 secondary indexes. When a database contains more than one secondary index, the database is called a shared index database. HALDBs and DEDBs do not support shared secondary indexes. - INDICES= parameter
You can specify an INDICES= parameter on the PCB in the SENSEG statement, to specify a secondary index that contains search fields used to qualify SSAs for an indexed segment type. - Using secondary indexes with logical relationships
You can use secondary indexes, except for Fast Path secondary indexes, with logical relationships. - Using secondary indexes with variable-length segments
If a variable-length segment is a source segment, when an occurrence of it is inserted that does not have fields specified for use in the search, subsequence, or duplicate data fields of the pointer segment, the following events can occur. - Considerations when using secondary indexing
When you use secondary indexes with your databases, you should be aware of a number of considerations. - Example of defining secondary indexes
The secondary index in this example is used to retrieve COURSE segments based on student names. - DEDB partitioned secondary indexes
DEDB partitioned secondary indexes allow a DEDB secondary index to be spread across multiple physical databases. A maximum of 101 user partition databases per Fast Path secondary index database are supported. - Multiple index entries for Fast Path secondary indexes
You can create multiple Fast Path secondary index entries from different fields in the same source segment. - Considerations for HALDB partitioned secondary indexes
A secondary index of a HALDB database must be a HALDB partitioned secondary index (PSINDEX).
Parent topic: Database types and functions
Related concepts:
Related reference: