Copying Members Have Alias Names


The COPY or COPYGRP statement is used to copy members with alias names from one PDS (or PDSE) to another.

Rules -

  • All members with their aliases are copied if they copy an entire PDS to a new one.
  • If merging a PDS with another, members or aliases will not change on the output PDS.
  • When selectively copying, we need to specify every member name, including their aliases.
  • To exclude a member, we should specify that member's name and all of its alias names to exclude it from the copy operation.

Practical Example -


Scenario - Copying member (COPY) and its alias (COPYALIA) from one PDS to another.

Input -

COPY Alias Input

JCL -

----+----1----+----2----+----3----+----4----+----5----+
//MATEPKC  JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID
//***********************************************
//* COPY MEMBER AND ITS ALIAS
//***********************************************
//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 INDD=SYSUT1,OUTDD=SYSUT2
     SELECT MEMBER=(FIRSTPRG,FSTALIAS)
/* 

Job Status -

COPY Alias Job Status

Output -

COPY Alias Output

Explaining Example -

  • SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS - Specifies the input PDS.
  • SYSUT2 DD DSN=MATEPK.IEBCOPY.OUTPDS - Specifies the output PDS.
  • COPYGRP INDD=SYSUT1,OUTDD=SYSUT2 - Copies members from SYSUT1 to SYSUT2.
  • SELECT MEMBER=(FIRSTPRG,FSTALIAS) - Copies member FIRSTPRG and its alias FSTALIAS from SYSUT1 to SYSUT2.