Rename members while copying PDS


IEBCOPY COPY statement used to rename the members while copying from source to destination PDS. This process helps when copying from two or more members from source PDS that has the same name.

Practical Example -


Scenario - Rename FIRSTPRG as FIRPRG1 while copying from one PDS to another.

JCL -

----+----1----+----2----+----3----+----4----+----5----+
//MATEPKC  JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID
//****************************************************************
//* Rename member while copying from one PDS to other
//****************************************************************
//STEP10   EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSDUMP  DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBCOPY.INPPDS,DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBCOPY.OUTPDS,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(10,10,10),RLSE),
//            UNIT=3390,VOL=SER=DEVHD2,
//            DCB=(DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN    DD *
     COPY INDD=SYSUT1,OUTDD=SYSUT2
     SELECT MEMBER=(IDENTDIV,(FIRSTPRG,FIRPRG1))
/*

Job Status -

Rename member Job Status

Output -

Rename member Output

Explaining Example -

  • SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS,.. - Specifies the input PDS.
  • SYSUT2 DD DSN=MATEPK.IEBCOPY.OUTPDS,.. - Specifies the output new PDS.
  • COPY INDD=SYSUT1,OUTDD=SYSUT2 - Copies all members from SYSUT1 to SYSUT2.
  • SELECT MEMBER=(IDENTDIV,(FIRSTPRG,FIRPRG1)) - Copies IDENTDIV with same name and renames FIRSTPRG as FIRPRG1 while copying to new PDS.