Secondary index
Every secondary index file must be initialized with a header record having the minimum record length, 76 characters, all set to binary zeroes.
This is a sample of JCL that initializes the header record of a
secondary index file. It can be run separately or added to the job
that creates the VSAM files.
//*---------------------------------------------------------------*
//* PREPARE HEADER RECORD
//*---------------------------------------------------------------*
//INIT01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0
/*
//SORTOUT DD DSN=OPCDEV2.RES.SKIHDR,DISP=(NEW,CATLG),UNIT=SYSDA,
DCB=(RECFM=F,LRECL=76,BLKSIZE=76),SPACE=(TRK,(1))
//DFSPARM DD *
RECORD TYPE=F
SORT FIELDS=(1,1,CH,A)
OUTREC FIELDS=(76X’00’)
//*---------------------------------------------------------------*
/* INITIALIZE SECONDARY INDEX
//*---------------------------------------------------------------*
//INIT02 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO INDATASET(OPCDEV2.RES.SKIHDR)-
OUTDATASET(OPCDEV2.RES.SKI0X)
//*---------------------------------------------------------------*
//* DELETE INPUT FILE
//*---------------------------------------------------------------*
//INIT03 EXEC PGM=IEFBR14
//SORTOUT DD DSN=OPCDEV2.RES.SKIHDR,DISP=(OLD,DELETE,DELETE)