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.
Although using a shared index database can save some main storage, the disadvantages of using a shared index database generally outweigh the small amount of space that is saved by its use.
The original advantage of a shared index database was that it saved a significant amount of main storage for buffers and some control blocks. However, when VSAM was enhanced with shared resources, the savings in storage became less significant.
For example, performance can decrease when more than one application program simultaneously uses the shared index database. (Search time is increased because the arm must move back and forth between more than one secondary index.) In addition, maintenance, recovery, and reorganization of the shared index database can decrease performance because all secondary indexes are, to some extent, affected if one is. For example, when a database that is accessed using a secondary index is reorganized, IMS automatically builds a new secondary index. This means all other indexes in the shared database must be copied to the new shared index.
If you are using a shared index database, you need to know the following information:
- A shared index database is created, accessed, and maintained just like an index database with a single secondary index.
- The various secondary indexes in the shared index database do not need to index the same database.
- One shared index database could contain all secondary indexes for your installation (if the number of secondary indexes does not exceed 16).
In a shared index database:
- All index segments must be the same length.
- All keys must be the same length.
- The offset from the beginning of all segments to the search field
must be the same. This means all keys must be either unique or non-unique.
With non-unique keys, a pointer field exists in the target segment.
With unique keys, it does not. So the offset to the key field, if
unique and non-unique keys were mixed, would differ by 4 bytes.
If the search fields in your secondary indexes are not the same length, you might be able to force key fields of equal length by using the subsequence field. You can put the number of bytes you need to make each key field an equal length in the subsequence field.
- Each shared secondary index requires a constant specified for it, a constant that uniquely identifies it from other indexes in the secondary index database. IMS puts this identifier in the constant field of each pointer segment in the secondary index database. For shared indexes, the key is the constant, search, and (if used) the subsequence field.