COPY


  • COPY statement initiates one or more copy, unload, or load operations.
  • A single COPY statement can contain any number of operations.

Syntax -


//SYSIN     DD  *
[label] COPY OUTDD=DDname
		,INDD=[(]{DDname|(DDname,R) }[,...][)] 
		[LIST={YES|NO}]
/*
  • OUTDD=DDname - Specifies the DDname of the output PDS.
  • INDD=[(]{DDname|(DDname,R) }[,...][)] - Specifies the DDname of the input PDS.
  • R - Specifies that the members to be copied or loaded from the input PDS will replace any identically named members on the output PDS.
  • LIST={YES|NO} - Specify the altered member names to be listed in the SYSPRINT dataset. When ignored, the default listing option from the EXEC PARM gets applied.

Practical Example -


Scenario - Copy all member from one PDS to another. Both PDS are on same volume.

JCL -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
//MATEPKC  JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),           
//             NOTIFY=&SYSUID                                           
//***************************************************                   
//* TO COPY PDS DATA SET ANOTHER PDS DATA SET                           
//***************************************************                   
//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=STRVL2,                                 
//            DCB=(DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=800)              
//SYSIN    DD *                                                         
     COPY INDD=SYSUT1,OUTDD=SYSUT2                                      
/*

Job Status -

COPY Job Status

Output -

COPY Output

Explaining Example -

  • SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS - Specifies the input PDS and resides on the volume STRVL2.
  • SYSUT2 DD DSN=MATEPK.IEBCOPY.OUTPDS,.. - Specifies the output new PDS and creating on the volume STRVL2.
  • COPY INDD=SYSUT1,OUTDD=SYSUT2 - Copies all members from SYSUT1 to SYSUT2. Both input and output datasets are on same volume.