Alternate index
A second index over a VSAM dataset, so records can be found by another field as well as by the main key.
Also written AIX, DEFINE AIX, DEFINE PATH, BLDINDEX, ALTERNATE RECORD KEY
A KSDS has one key, such as the account number, and you can look records up by that key. An alternate index, or AIX, adds a second way to find records: for example, looking up the same account records by customer number.
An alternate index is a separate VSAM dataset that maps each alternate key value to the main key of the matching records. Unlike the main key, an alternate key does not have to be unique. One customer number can point to several accounts.
Setting one up takes three IDCAMS steps. DEFINE AIX creates the index, DEFINE PATH creates the name programs use to reach records through it, and BLDINDEX fills it from the existing data. With the UPGRADE option, VSAM keeps the index up to date whenever the main dataset changes. In COBOL, the alternate key is named with ALTERNATE RECORD KEY in the SELECT statement.
Each alternate index makes every update slower, because the index has to change too. Sites add them where they are really needed and avoid having many on files that change often.
Where can I learn this hands-on?
Right here, at ZedBank. You take a junior job at a simulated bank and learn each part of the work by doing it, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- KSDSThe most common VSAM dataset type, where every record has a unique key used to find it directly.
- VSAMA family of dataset types built for fast record access by key, used where applications need to look records up rather than read them in order.
- IDCAMSThe utility used to create, list, copy and delete datasets, and the standard tool for anything involving VSAM.
- Primary keyThe column or columns that uniquely identify each row in a table, so no two rows share the same value.
- File descriptionThe FD entry in a COBOL program that describes a file's records, connecting the program to data supplied by the JCL.
- IndexA structure that lets a database find rows by value without reading the whole table.