REPRO Command (for Beginners)
Summary
For extensive information, go through the REPRO Command (for Experienced)
REPRO command is used to copy the data from one file (input) to another file (output). The input or output datasets can be single or multiple.
REPRO command is used on both VSAM (ESDS, KSDS, RRDS, etc.) and non-VSAM datasets (flat file, PS file, PDS member).
Detailed syntax -
//JOBNAME JOB job-card-parameters
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO {INFILE(ddname)|INDATASET(dataset-name)}
{OUTFILE(ddname)| OUTDATASET(dataset-name)}
[FILE(ddname)]
[FROMKEY(key)|FROMADDRESS(address)|
FROMNUMBER(starting-rrb-number)|SKIP(number)]
[REPLACE|NOREPLACE]
[REUSE|NOREUSE]
[TOKEY(key)|TOADDRESS(address)|
TONUMBER(number)|COUNT(number)]
/*
Parameters
The REPRO command mandatory and optional parameters are specified below -
Mandatory Parameters
Parameters | Description |
---|---|
INFILE (ddname) | Specifies the input dataset to be copied. Short Description: IFILE |
OUTFILE(ddname) | Specifies the output dataset where to copy the data. Short Description: OFILE |
INDATASET(dataset-name) | Specifies the input dataset to be copied or user catalog to be merged. Short Description: IDS |
OUTDATASET(dataset-name) | Specifies the output dataset. Short Description: ODS |
Optional Parameters
Parameters | Description |
---|---|
FROMKEY(key) | Specify the first record's key from where the copy needs to start. Short Description: FKEY |
TOKEY(key) | Specifies the key of the last record where the copy should end. |
FROMADDRESS(address) | Specifies the first record relative byte address (RBA) from where the copy needs to start. Short Description: FADDR |
TOADDRESS(address) | Specifies the relative byte address (RBA) of the last record where the copy should end. Short Description: TADDR |
FROMNUMBER(number) | Specifies the first record relative record number (RRN) from where the copy needs to start. Short Description: FNUM |
TONUMBER(number) | Specifies the relative record number (RRN) of the last record where the copy should end. Short Description: TNUM |
SKIP(number) | Specifies the number of records that need to skip before beginning to copy records. |
COUNT(number) | Specifies the number of logical records that should copy. |
Example -
Requirement - Copy data from KSDS to PS file from E0003 to E0005.
Input ESDS File - MATEPK.TEST.ESDS
Key
<===>----10---+----2----+----3----+----4----+--
**** Top of data ****
E0001EMPLOYEE1 DIR LOC1 0000100000
E0002EMPLOYEE2 MGR DEPT1LOC1 0000080000
E0003EMPLOYEE3 MGR DEPT2LOC2 0000075000
E0004EMPLOYEE4 TL DEPT1LOC1 0000050000
E0005EMPLOYEE5 SSE DEPT1LOC1 0000045000
E0006EMPLOYEE6 SE DEPT1LOC1 0000034000
E0007EMPLOYEE7 SSE DEPT2LOC2 0000046000
**** End of data ****
Code -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//MATEPKR JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//************************************************************
//* REPRO/COPY DATA FROM VSAM KSDS TO PS DATA SET
//************************************************************
//STEP010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INPUT DD DSN=MATEPK.EMPL.KSDS,DISP=SHR
//OUTPUT DD DSN=MATEPK.EMPL.PSFILE,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(1,1),RLSE),
// UNIT=SYSDA,
// DCB=(DSORG=PS,RECFM=FB,LRECL=47,BLKSIZE=470)
//SYSIN DD *
REPRO -
INFILE(INPUT) -
OUTFILE(OUTPUT) -
FROMKEY(E0003) -
TOKEY(E0005)
/*
//*
**************************** Bottom of Data ****************************
In the above JCL, MATEPK is the userid and change it as required.
Output -
Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, then REPRO is successful..
********************************* TOP OF DATA **********************************
IDCAMS SYSTEM SERVICES TIME: 10:47:50
REPRO -
INFILE(INPUT) -
OUTFILE(OUTPUT) -
FROMKEY(E0003) -
TOKEY(E0005)
IDC0005I NUMBER OF RECORDS PROCESSED WAS 3
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0
******************************** BOTTOM OF DATA ********************************
Verify the path in 3.4 (Dataset List utility) or any File management tools.
=COLS> ----+----1----+----2----+----3----+----4----+--
****** ***************************** Top of Data ******************************
000001 E0003EMPLOYEE3 MGR DEPT2LOC2 0000075000
000002 E0004EMPLOYEE4 TL DEPT1LOC1 0000050000
000003 E0005EMPLOYEE5 SSE DEPT1LOC1 0000045000
****** **************************** Bottom of Data ****************************
Explaining Example -
In the above example,
- INFILE(INPUT) specifies the input file.
- OUTFILE(OUTPUT) specifies the output file.
- FROMKEY(E0003) specifies starting record to copy.
- TOKEY(E0003) specifies last record to copy.