Copies data between files (REPRO)


The REPRO command copies records from one dataset to another. It can also copy data between different types of datasets, including VSAM datasets (such as KSDS, ESDS, and RRDS) and sequential datasets. The input or output datasets can be single or multiple.

Functions -

REPRO functions are -

  • Copy the data from one dataset to another.
  • Copies catalogs.
  • Load the empty VSAM cluster with records. While loading, it buids the INDEX automatically (applicable to KSDS and VRRDS).
  • Creates a backup or restore of a VSAM files, PS files, or tapes.
Notes!
  • No sorting is mandatory while loading ESDS.
  • All records should be sorted based on the key-value while loading KSDS.
  • All records should be in the sorted order based on the assumed key field while loading to RRDS.
  • If the logical record length of a non-VSAM dataset is greater than 32760 bytes, the REPRO command ends with an error message.
  • If the VSAM dataset is defined with a record length greater than 32760 and tries to copy the data to a sequential dataset, the REPRO command ends with an error message.

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(rrb-number) | 
	 SKIP(number)]
  	[REPLACE | NOREPLACE]
  	[REUSE | NOREUSE]
  	[TOKEY(key) | 
	 TOADDRESS(address) | 
  	 TONUMBER(number) | 
	 COUNT(number)]
/*

Mandatory Parameters


  • INFILE(ddname) - Specifies the DD name of the input dataset from which records will be copied. This can be a VSAM or a sequential dataset. Short Description: IFILE
  • INDATASET(dataset-name) - Specifies the input DSN from which records will be copied. This can be a VSAM or a sequential dataset. Short Description: IDS
  • OUTFILE(ddname) - Specifies the DD name of the output dataset where records will be copied to. This can also be a VSAM or a sequential dataset. Short Description: OFILE
  • OUTDATASET(dataset-name) - Specifies the output DSN where records will be copied to. This can also be a VSAM or a sequential dataset. Short Description: ODS

Optional Parameters


  • FILE(ddname) - Specifies the DDnames that identifying all the required volumes.
  • FROMKEY(key) | FROMADDRESS(address) | FROMNUMBER(number) | SKIP(number) - Specifies the starting position from where the copy should start. If any of these parameters are not coded, the copy begins with the first logical record in the dataset. Short Descriptions: FKEY (key), FADDR (address), FNUM (number)
  • TOKEY(key) | TOADDRESS(address) | TONUMBER(number) | COUNT(number) - Specifies the ending position where the copy should end. If any of these parameters are not coded, the copy ends at the last logical record in the dataset. Short Descriptions: TADDR (address), TNUM (number)
  • REUSE | NOREUSE -
    • REUSE - allows the dataset to be reused if it is deleted and then recreated. Short Description: RUS
    • NOREUSE - indicates that the dataset is not reused after being deleted. Short Description: NRUS
  • REPLACE | NOREPLACE -
    • REPLACE - Specifies records are replaced in the output dataset if the record key is matched in the input and output datasets. Short Description: REP
    • NOREUSE - Specifies records are not replaced in the output dataset if the record key is matched in the input and output datasets. Short Description: NREP

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----+
...
//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..

REPRO Sysprint

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