How to Define Alternate Index in VSAM Using IDCAMS Utility

Here’s sample JCL to define VSAM alternate index using IDCAM BLDINDEX parameter. In the below JCL, the IDS is ESDS base cluster and the ODS is Alternate index.

Sample VSAM Cluster

//BIX1 EXEC PGM=IDCAMS 
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTWK01 DD SPACE=(CYL,(50,50))
//SORTWK02 DD SPACE=(CYL,(50,50))
//SYSIN DD * BLDINDEX 
 IDS(VSAMAIX.BIX.ESDS) 
 ODS(VSAMAIX.BIX.AIX) 
 SORTMESSAGELEVEL(ALL)
/*

Note: IDCAMS allocates the SYSOUT and SORTWKxx data sets dynamically if they’re not present in the JCL.

SORTMESSAGELEVEL(ALL) , it ensures all of the SORT messages are written to SYSOUT.

The other way to define VSAM AIX

//BUFSP EXEC PGM=IDCAMS
//ESDS  DD DSN=VSAMAIX.BIX.ESDS,DISP=SHR,AMP='BUFSP=500000'
//AIX   DD DSN=VSAMAIX.BIX.AIX,DISP=SHR,AMP='BUFSP=500000'
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SORTWK01 DD SPACE=(CYL,(50,50))
//SORTWK02 DD SPACE=(CYL,(50,50))
//SYSIN    DD *
 BLDINDEX IFILE(ESDS) 
 OFILE(AIX) 
 SORTML(ALL)
/*

Related

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.