TSO-ISPF JCL COBOL VSAM DB2 CICS IMS-DB Tools Articles Forum Quiz Interview Q&A

JCL - IEBCOPY Utility


IEBCOPY is a data set utility that is used to copy or merge members between one or more partitioned data sets or partitioned data sets extended (PDSEs). The copying can be full copy or partial copy.

IEBCOPY used to create a backup of a partitioned data set into a sequential data set and to copy members from the backup into a partitioned data set. IEBCOPY automatically lists the number of unused directory blocks.

More specifically, this utility is commonly used for several purposes:

  1. To copy selected (or all) members from one partitioned data set to another.

  2. To copy a partitioned data set into a unique sequential format known as an unloaded partitioned data set. As a sequential data set it can be written on tape, sent by FTP, or manipulated as a simple sequential data set.

  3. To read an unloaded partitioned data set (which is a sequential file) and recreate the original partitioned data set. Optionally, only selected members might be used.

  4. To compress partitioned data sets (in place) to recover lost space.


Example 1:

All members of data set userid.TEST.DATA.IN are copied to userid.TEST.DATA.OUT

//JOBIBMKS JOB (123),'IBMMAINFRAMER',CLASS=C,MSGCLASS=S,MSGLEVEL=(1,1),
//       NOTIFY=&SYSUID
//*
//STEP001  EXEC  PGM=IEBCOPY
//SYSPRINT DD  SYSOUT=*
//SYSOUT1  DD  DSNAME=userid.TEST.DATA.IN,
//             DISP=SHR,VOL=SER=1234
//             UNIT=DISK
//SYSOUT2  DD  DSNAME=userid.TEST.DATA.OUT,
//             UNIT=DISK,VOL=SER=1234,
//             DISP=(NEW,KEEP),SPACE=(TRK,(5,1,2))
//SYSIN    DD DUMMY
/*

Explanation:

  • SYSUT1 DD defines a PDS DATASET1 that contains three members (A, B and C).

  • SYSUT2 DD defines a new PDS DATASET2 that is to be kept after the copy operation.

  • Input and output data sets are identified as SYSUT1 and SYSUT2, the SYSIN data set is not needed.

  • The SYSUT1 data set will be copied in full to the SYSUT2 data set.

  • After the copy operation is finished, DATASET2 will contain the same members that are in DATASET1.

Instead of using the DUMMY parameter on the SYSIN DD statement, you could substitute this JCL.

//SYSIN DD *
  COPY OUTDD=SYSUT2,INDD=SYSUT1
  SELECT MEMBER=(PGM1,PGM2)
/*

The SELECT statement specifies the member names to be processed, with the OUTDD and INDD parameters specifying the DD names to be used for output and input, respectively. You would have to use this JCL if you used names other than SYSUT1 and SYSUT2 for the input and output DD statements.

Restoring a partitioned data set from an unloaded copy automatically compresses (recovers lost space) the data set.


Example 2:

Including members of PDS in a COPY command

//JOBIBMKS JOB (123),'IBMMAINFRAMER',CLASS=C,MSGCLASS=S,MSGLEVEL=(1,1),
//       NOTIFY=&SYSUID
//*
//STEP001  EXEC  PGM=IEBCOPY
//SYSPRINT DD  SYSOUT=*
//SYSOUT1  DD  DSNAME=userid.TEST.DATA.IN,
//             DISP=SHR,VOL=SER=1234
//             UNIT=DISK
//SYSOUT2  DD  DSNAME=userid.TEST.DATA.OUT,
//             UNIT=DISK,VOL=SER=1234,
//             DISP=(NEW,KEEP),SPACE=(TRK,(5,1,2))
//SYSIN    DD  *
  COPY  INDD=SYSOUT1,OUTDD=SYSOUT2
  SELECT MEMBER=(A,C)
/*

Example 3:

Excluding members of PDS in a COPY command.

//JOBIBMKS JOB (123),'IBMMAINFRAMER',CLASS=C,MSGCLASS=S,MSGLEVEL=(1,1),
//       NOTIFY=&SYSUID
//*
//STEP001  EXEC PGM=IEBCOPY
//*********************************************************
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=userid.JCLTEST.JCL,DISP=SHR
//SYSUT2   DD DSN=userid.JCLTEST.JCLS.OTHERS,
//          DISP=(NEW,CATLG,DELETE),
//          SPACE=(CYL,(10,10,40),RLSE),
//          DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)
//SYSIN    DD *
  COPY INDD=SYSUT1,OUTDD=SYSUT2
  EXCLUDE MEMBER=(PGM1,PGM2,PGM3,PGM4,
     PGM5,PGM6)
/*

Example 4:

Renaming a member while copying

//JOBIBMKS JOB (123),'IBMMAINFRAMER',CLASS=C,MSGCLASS=S,MSGLEVEL=(1,1),
//       NOTIFY=&SYSUID
//*
//STEP001  EXEC PGM=IEBCOPY
//*********************************************************
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=userid.JCLTEST.JCL,DISP=SHR
//SYSUT2   DD DSN=userid.JCLTEST.JCL.OTHER,
//       DISP=(NEW,CATLG,DELETE),
//       SPACE=(CYL,(5,5,5),RLSE),
//       DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)
//SYSIN DD *
  COPY INDD=SYSUT1,OUTDD=SYSUT2
  SELECT MEMBER=(PGM1,PGM2,PGM3,PGM4,
  PGM5,(PROGRAM6,PGM6))
/*


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal