Building an IAM Alternate Index
The process of building an IAM Alternate Index is identical to the VSAM process. The Alternate Index is usually built by use of the IDCAMS BLDINDEX command. However, other programs that have been written to build Alternate Indexes for VSAM can be used to build IAM too. The internal record format of the IAM Alternate Index record is identical to the VSAM format.
Using IDCAMS BLDINDEX
The BLDINDEX command for IDCAMS has two main operands, specifying the input file, or data set, which is the base cluster, and specifying the output file or data set, which is the Alternate Index. As long as there is sufficient virtual storage to sort the alternate key / prime key pairs, or if you have DFSORT, the example shown below of using IDCAMS BLDINDEX can be used. For complete information on using the IDCAMS BLDINDEX please refer to the IBM space “DFSMS/MVS ACCESS METHOD SERVICES for the Integrated Catalog Facility”, number SC26-4906.
Example of IDCAMS BLDINDEX (EX1062A)
//SYSPRINT DD SYSOUT=*
//IAMINFO DD SYSOUT=*
//BASE DD DISP=OLD,DSN=example.iam.cluster
//AIX DD DISP=OLD,DSN=example.iam.aix
//SYSIN DD *
BLDINDEX INFILE(BASE)OUTFILE(AIX)
/*
There are a few things to notice in the above example. First, the base cluster is allocated with a disposition of OLD. This is done to prevent updates from occurring while the Alternate Index is being built that could cause an out of synch condition with the Alternate Index. Second, there is an optional IAMINFO DD card in the JCL. This will cause IAM to produce an activity report for each IAM data set that has been used.
If you do not have DFSORT and enough virtual storage available for an internal sort, then you will need to add two work files for the BLDINDEX to work. The space requirements will depend on the size of your files, and up to five volumes can be specified for each work file. IDCAMS will define two ESDS type of files to these DD statements to use for sorting the data. The default DD names used by IDCAMS are IDCUT1 and IDCUT2. An example is shown below of using the work files.
Example of IDCAMS BLDINDEX with work files (EX1062B)
//SYSPRINT DD SYSOUT=*
//IAMINFO DD SYSOUT=*
//IDCUT1 DD DSN=workfile1,VOL=SER=volser,
// UNIT=unitname,DISP=OLD,AMP='AMORG'
//IDCUT2 DD DSN=workfile2,VOL=SER=volser,
// UNIT=unitname,DISP=OLD,AMP='AMORG'
//BASE DD DISP=OLD,DSN=example.iam.cluster
//AIX DD DISP=OLD,DSN=example.iam.aix
//SYSIN DD *
BLDINDEX INFILE(BASE)OUTFILE(AIX)
/*
Using IAM ISPF Panels to Build an Alternate Index
The IAM ISPF panels offer a build index function as well, that will invoke the IDCAMS BLDINDEX function. To go to the build index function from the IAM Primary Options panel, select option U for the utilities panel. From the IAM Utility Program Menu, as shown below, select option I to build the Alternate Index.
IAM ISPF utility selection menu
OPTION ===>
S Specify utility print dataset allocation parameters
I BLDINDEX - Build Alternate Index
M IAMBMON - Invoke IAMRLS Monitor
R IAMRECVR - IAM file diagnostic and recovery utility
V IAMSTATS - IAM VSAM Interface (VIF) module information
X IAMXMONI - IAM Execution Monitor/ISPF for CICS Regions
Z IAMZAPOP - IAM options table utility
P IAMUPTFS - IAM PTF Level Reporting
After pressing ENTER, IAM will display the Build Index panel. On this panel, enter the name of the base cluster and the name of the Alternate Index you want to build. After entering that information, press the enter key.
Example of IAM ISPF build index panel
COMMAND ===>
Base Cluster ===> MYIAM.CLUSTER
Alternate Index ===> MYIAM.AIX
Specify BASE and AIX dataset names and hit ENTER
When the Build Index function is complete, IAM ISPF will open a browse panel of the output from the IDCAMS BLDINDEX function. An example is shown below:
Sample output from BLDINDEX function
BLDINDEX INFILE(DISKIN) OUTFILE(DISKOUT)
IDC0652I CPPRAC.MYIAM.AIX SUCCESSFULLY BUILT
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0