Copies data between files (REPRO)
IDCAMS Copies data between files (REPRO) Example
Scenario - 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 ****
JCL -
----+----1----+----2----+----3----+----4----+----5----+
//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)
/*
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..

Verify the path in 3.4 (Dataset List utility) or any File management tools for the existance.
=COLS> ----+----1----+----2----+----3----+----4----+--
000001 E0003EMPLOYEE3 MGR DEPT2LOC2 0000075000
000002 E0004EMPLOYEE4 TL DEPT1LOC1 0000050000
000003 E0005EMPLOYEE5 SSE DEPT1LOC1 0000045000
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.