Replace members while copying
Scenario - Replace IDENTDIV 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
//****************************************************************
//* Replaces the member if it is in target PDS
//****************************************************************
//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=OLD
//SYSIN DD *
COPY OUTDD=SYSUT2,INDD=SYSUT1
SELECT MEMBER=((IDENTDIV,,R),FIRSTPRG)
/*
Job Status -
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 OUTDD=SYSUT2,INDD=SYSUT1 - Copies all members from SYSUT1 to SYSUT2.
- SELECT MEMBER=((IDENTDIV,,R),FIRSTPRG) - Replaces IDENTDIV replaces the member and FIRSTPRG copies to as it is to new PDS.