How do I copy from one master file to another using a wildcard and bringing over all the arclevels?

Document ID : KB000054991
Last Modified Date : 14/02/2018
Show Technical Document Details

Description

Need to copy all members from a master file to another master file using a wildcard. Also need to copy all members from one master file to another one.

Solution:

This can be done using AFOLIBR in a 3 step process the /TE/ copies all members starting with TE. To copy all members from one master file to another replace

-COPY NAME=/TE/,REP  with
-COPY NAME=  ,REP
STEP1     EXEC PGM=AFOLIBR,PARM='NJTA,NRJS'          
 //SYSPRINT  DD SYSOUT=*                                
 //MASTER    DD DSN=from.master.file,DISP=SHR            
 //OSJOB     DD DSN=&&TEMP,DISP=(,PASS),UNIT=SYSDA,     
 //        SPACE=(CYL,(50,15))                          
 //SYSIN  DD  *                                         
 -OPT GPO                                               
 -OPT UTILITY                                           
 -COPY NAME=/TE/,REP                                          
 -END                                                      
 //*                                                       
 //STEP2    EXEC PGM=AFOLIBR,PARM='NJTA,NRJS'              
 //MASTER    DD DSN=from.master.file,DISP=SHR               
 //LIST     DD  SYSOUT=*                                   
 //SYSPRINT DD  SYSOUT=*                                   
 //OSJOB    DD DSN=&&PASS,DISP=(,PASS),UNIT=SYSDA,         
 //        SPACE=(CYL,(50,15))                             
 //SYSIN    DD  DSN=&&TEMP,DISP=OLD                        
 //*                                                       
 //STEP3    EXEC PGM=AFOLIBR,PARM='NJTA,NRJS'              
 //MASTER   DD DSN=to.master.file,DISP=SHR                
 //LIST     DD  SYSOUT=*                                   
 //SYSPRINT DD SYSOUT=*                                    
 //OSJOB DD DUMMY                                          
 //SYSIN   DD DSN=&&PASS,DISP=OLD