The AMS REPRO command is used for initial loading of records into VSAM dataset. It is also used to copy data from one VSAM data set to another. We can use this command to copy data from sequential file to VSAM file.
The only two required parameters are those which specify the input dataset (the source of the records to be loaded) and the output cluster, which is to be loaded.
The input may be specified by either the INFILE parameter or the INDATASET parameter. When INFILE is used, the records are read from the DD name specified, and a DD statement must be supplied in the JCL matching the specified name. When INDATASET is used, the source of the input is located by searching the VSAM catalog for a matching object.
The VSAM cluster to receive the records read from the input dataset is specified by either OUTFILE or OUTDATASET. OUTFILE designates that the target cluster is specified by the inclusion of a DD statement in the JCL, while OUTDATASET designates that the cluster is to be located through the VSAM catalog.
REPRO INFILE(in-ddname) OUTFILE(out-ddname) |
The in-ddname is DD name for the Input Dataset which is having records. The out-ddname is the DD name for the Output Dataset, where the input datasets records will be copied.
REPRO INDATASET(input-dataset) OUTDATASET(output-dataset) |
The input-dataset is input Dataset which is having records. The output-dataset is the output dataset, where the input datasets records will be copied.
Following example shows how to copy records from one dataset to another VSAM dataset.
//JOBNAME1 JOB 'IBMMAINFRAMER',CLASS=C,PRTY=10,MSGCLASS=C, // MSGLEVEL=(1,1),NOTIFY=&SYSUID //* //STEP001 EXEC PGM=IDCAMS //IN DD DSN=racfid.VSAM.KSDSFILE.INPUT,DISP=SHR //OUT DD DSN=racfid.VSAM.KSDSFILE.OUTPUT,DISP=SHR //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INFILE(IN) OUTFILE(OUT) /* |
If you execute the above JCL. Job should complete successfully with MAXCC = 0 and it will copy all the records from racfid.VSAM.KSDSFILE.INPUT to racfid.VSAM.KSDSFILE.OUTPUT VSAM file.
The above example is same as below:
//JOBNAME1 JOB 'IBMMAINFRAMER',CLASS=C,PRTY=10,MSGCLASS=C, // MSGLEVEL=(1,1),NOTIFY=&SYSUID //* //STEP001 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * REPRO INDATASET(racfid.VSAM.KSDSFILE.INPUT) OUTDATASET(racfid.VSAM.KSDSFILE.OUTPUT) /* |
If you execute the above JCL. Job should complete successfully with MAXCC = 0 and it will copy all the records from racfid.VSAM.KSDSFILE.INPUT to racfid.VSAM.KSDSFILE.OUTPUT VSAM file.
FROMKEY may be included to specify either the full or generic key value that defines the starting point of the copy operation. FROMKEY is only applicable when the input dataset is a KSDS VSAM cluster or an ISAM dataset.
FROMADDRESS may be included to specify the RBA value that defines the starting point of the copy operation. FROMADDRESS is only applicable when the input dataset is a KSDS or ESDS VSAM cluster.
FROMNUMBER may be included to specify the relative record number that defines the starting point of the copy operation. FROMNUMBER is only applicable when the input dataset is a RRDS VSAM cluster.
SKIP may be included to bypass the specified number of records from the input dataset before starting the copy operation.
TOKEY may be included to specify either the full or generic key value that defines the ending point of the copy operation. TOKEY is only applicable when the output cluster is a KSDS VSAM cluster.
TOADDRESS may be included to specify the RBA value that defines the ending point of the copy operation.. TOADDRESS is only applicable when the output dataset is a KSDS or ESDS VSAM cluster.
TONUMBER may be included to specify the relative record number that defines the ending point of the copy operation. TONUMBER is only applicable when the output dataset is a RRDS VSAM cluster.
COUNT may be included to terminate the copy operation after the specified number of records have been copied to the output cluster.
REPLACE may be specified to cause existing records in the output cluster to be replaced when a duplicate record is read from the input dataset. REPLACE is applicable for KSDS and RRDS clusters.
REPLACE may also be used to merge input from subsequent REPRO operations with different input datasets to the same target dataset, where the possibility of duplicate records.
If an attempt is made to add a duplicate record and REPLACE is not specified, an error message and the input record is discarded; on the fourth occurrence of a duplicate record, the REPRO operation is terminated and the remainder of the input file is not processed.
The REUSE parameter may be specified to cause the output cluster to be reset to empty status before loading commences. In order for the REUSE parameter to be allowable, the output cluster must have been defined with the REUSE attribute.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!