How can I copy all members from a master file but only want the current version of each member?

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

Description:

Existing master file has archived turned on and I need a copy of this file with only the current version of each member.

Solution:

Create a new master file then copy over the existing master file. A 3 step job will be used. The key here is the 2nd step is a LIBRCOPY which will only copy the current level of each member to the new master file.

//STEP1    EXEC PGM=AFOLIBR,PARM='NRJS,NJTA'
//SYSPRINT DD   SYSOUT=*                         
//OSJOB    DD   DSN=your.gpo,DISP=(,CATLG),      
//         UNIT=SYSDA,                           
//         DCB=(RECFM=FB,LRECL=80,BLKSIZE=800), 
//         SPACE=(TRK,(3,1))                    
//MASTER   DD   DSN=your.from.master,DISP=SHR    
//SYSIN    DD *                                  
-OPT GPO                                         
-OPT UTILITY                                     
-COPY NAME= ,                                    
-END                                             
//*                                              
//STEP2    EXEC PGM=LIBRCOPY                     
//SYSPRINT DD   SYSOUT=*                         
//OSJOB    DD   DSN=your.gpo1,DISP=(,CATLG),     
//         UNIT=SYSDA,                           
//         DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),  
//         SPACE=(TRK,(3,1))                     
//MASTER   DD   DSN=your.from,master,DISP=SHR    
//DESTMAST DD   DSN=your.new.master,DISP=SHR     
//SYSIN    DD   DSN=your.gpo,DISP=SHR            
//*                                              
//STEP3    EXEC PGM=AFOLIBR,PARM='NRJS,NJTA'    
//SYSPRINT DD   SYSOUT=*                        
//OSJOB    DD   DUMMY                           
//SYSAF01      DD UNIT=SYSDA,SPACE=(CYL,(1,1))  
//SYSAF02      DD UNIT=SYSDA,SPACE=(CYL,(1,1))  
//MASTER   DD  DSN=your.new.master,DISP=SHR  
//SYSIN    DD  DSN=your.gpo1,DISP=SHR      
//*