Module 3: Access Method Services (AMS)
Loading a ESDS
- ESDS can be loaded in two ways:-
- In JCL, using REPRO command of IDCAMS
- Using COBOL program to read records from input file and write them to output dataset
- Here, we will focus on loading of KSDS using REPRO
- REPRO command is explained in ‘IDCAM REPRO command’ article
- While loading ESDS using REPRO command, it is not mandatory to sort records as records are loaded in entry sequenced
Example 1
Use of REPRO to copy PS file ESDS file
//PSESDS EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//DD01 DD DSN=PAYT.PAYROLL.PRCS.PSFILE,DISP=SHR
//DD02 DD DSN=PAYT.PAYROLL.PRCSESDS.MSTR,DISP=SHR
//SYSIN DD *
REPRO INFILE(DD01) OUTFILE(DD02)
/*
Example 2
Use of REPRO to selectively copy records from one ESDS file to another ESDS file
Note:- In this example we want to copy records that falls between address 325 and 950
//REPESDS EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//DD01 DD DSN=PAYT.PAYROLL.PRCSESDS.MSTR,DISP=SHR
//DD02 DD DSN=PAYT.PAYROLL.PRCSESDS.MSTR2,DISP=SHR
//SYSIN DD *
REPRO INFILE(DD01) OUTFILE(DD02) -
FROMADDRESS(325) TOADDRESS(950)
/*
Example 3
Use of REPRO to copy records from KSDS file to ESDS file
//REPESDS EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//DD01 DD DSN=PAYT.PAYROLL.PRCSKSDS.KSDS,DISP=SHR
//DD02 DD DSN=PAYT.PAYROLL.PRCSESDS.ESDS,DISP=SHR
//SYSIN DD *
REPRO INFILE(DD01) OUTFILE(DD02)
/*