How do I copy multiple members from one Master file to another Master file with all archive levels and replace what is there?

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

Need to copy some members from one Master file to another Master file and the members already exist on the TO Master file. I also want to copy all archive levels.

Answer:

Using the JCL below, specify the member names you need to copy in the -COPY command with the REP option:

//STEP1     EXEC PGM=AFOLIBR,PARM='NRJS,NJTA'                    
//OSJOB     DD DSN=&&UTIL,DISP=(,PASS),UNIT=SYSDA,                
//          SPACE=(CYL,(1,1)),                                    
//          DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)                  
//SYSPRINT  DD SYSOUT=*                                           
//LIST      DD SYSOUT=*                                           
//INDEX     DD SYSOUT=*                                           
//MASTER    DD DSN=from.master.file,DISP=SHR                     
//SYSIN     DD   *                                            
-OPT UTILITY                                                         
-COPY MBR1,REP
-COPY MBR2,REP
-COPY MBR3,REP -END //STEP2 EXEC PGM=AFOLIBR,PARM='NRJS,NJTA' //OSJOB DD DUMMY //SYSPRINT DD SYSOUT=* //LIST DD SYSOUT=* //INDEX DD SYSOUT=* //MASTER DD DSN=to.master.file,DISP=SHR //SYSIN DD DSN=&&UTI,DISP=(OLD,PASS) /*