Here’s a sample JCL (Job Control Language) code to create a VSAM (Virtual Storage Access Method) alternate index using the IDCAMS BLDINDEX parameter. This JCL code defines the base cluster as an ESDS (Entry Sequenced Data Set) and the alternate index as an ODS (Ordered Data Set).

VSAM BLDINDEX
Photo by Helena Lopes on Pexels.com

VSAM BLDINDEX: Creating AIX

//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: Creating 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