Examples of IDCAMS to copy
General JCL to copy a file (sequential, VSAM, PDS member)
to an existing file (sequential, VSAM, PDS member)
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INFILE DD DSN=name of file to be copied,DISP=SHR
//SYSIN DD *
REPRO INFILE(INFILE) OUTFILE(OUTFILE)
/*
//OUTFILE DD DSN=name of file to be replaced,DISP=SHR
Example of JCL to copy the file ABCCO.TEST.DATA (could be sequential, VSAM, PDS member)
to the existing file ABCCO.SAMPLE.DATA
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INFILE DD DSN=ABCCO.TEST.DATA,DISP=SHR
//SYSIN DD *
REPRO INFILE(INFILE) OUTFILE(OUTFILE)
/*
//OUTFILE DD DSN=ABCCO.SAMPLE.DATA,DISP=SHR
Notes:
IDCAMS will copy any of the following types:
Sequential
PDS member
VSAM
ISAM
to any of the following:
Sequential
PDS member
VSAM
ISAM
This JCL will clobber any data that already exists in the output file.
However, if the output file is VSAM and you want to clobber it,
you must add the keyword REUSE, for example:
REPRO INFILE(INFILE) OUTFILE(OUTFILE) REUSE
and you must have defined the VSAM cluster with REUSE.
Using IDCAMS to delete a file. If the file is not found,
there will be an error message and high return code.
//* delete with idcams
//DELETE EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
DELETE dataset-name
Using IDCAMS to shorten a file by copying it with the skip or count parameter.
//* shorten a file
//SHORT01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
REPRO INFILE(INDD) OUTFILE(OUTDD) SKIP(0001000) COUNT(0001000)
/*
//INDD DD DSN=input-file,DISP=OLD
//OUTDD DD DSN=output-file,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(5,2),RLSE),
// DCB=(RECFM=FB,LRECL=xx)
//*