Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 3: Access Method Services (AMS)


Loading a RRDS

  • RRDS can be loaded in two ways:-
    1. In JCL, using REPRO command of IDCAMS
    2. Using COBOL program to read records from input file and write them to output dataset
  • Here, we will focus on loading of RRDS using REPRO
  • REPRO command is explained in ‘IDCAM REPRO command’ article
  • While loading RRDS, records can be sorted on the field that correlates to the relative record number. During RRDS load, the records are loaded in relative record sequence starting with 1.

Example 1

Use of REPRO to copy PS file RRDS file

//PSRRDS EXEC PGM=IDCAMS //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //DD01 DD DSN=PAYT.PAYROLL.PRCS.PSFILE,DISP=SHR //DD02 DD DSN=PAYT.PAYROLL.PRCSRRDS.MSTR,DISP=SHR //SYSIN DD * REPRO INFILE(DD01) OUTFILE(DD02) /*

Example 2

Use of REPRO to KSDS file to RRDS file

Note:- We will use REPLACE parameter here since we do not want Job failure in case if REPRO tries to copy records with duplicate key. REPLACE command will replace the existing record with new record in case of duplicate key

//REPRRDS EXEC PGM=IDCAMS //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //DD01 DD DSN=PAYT.PAYROLL.PRCSKSDS.KSDS,DISP=SHR //DD02 DD DSN=PAYT.PAYROLL.PRCSRRDS.RRDS,DISP=SHR //SYSIN DD * REPRO INFILE(DD01) OUTFILE(DD02) /*

Example 3

Use of REPRO to copy selectively copy records from one RRDS file to another RRDS file

Note: FROMNUMBER and TONUMBER parameter can be coded to selectively copy records. Using REPLACE keyword, one can overwrite duplicate records which will avoid job failure too.

//REPRRDS EXEC PGM=IDCAMS //SYSOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=* //DD01 DD DSN=PAYT.PAYROLL.PRCSRRDS.RRDS1,DISP=SHR //DD02 DD DSN=PAYT.PAYROLL.PRCSRRDS.RRDS2,DISP=SHR //SYSIN DD * REPRO INFILE(DD01) OUTFILE(DD02) - FROMNUMBER(5) TONUMBER(15) /*






© copyright mainframebug.com
Privacy Policy