How do I delete all members off a master file?

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

Description:

Need to delete all members off a master file in batch.

Solution:

Using the JCL below this will delete all the members off the master file:

//STEP1         EXEC PGM=AFOLIBR,PARM='NRJS,NJTA'                   
//SYSPRINT     DD SYSOUT=*                                          
//MASTER       DD DSN=your.master.file,DISP=SHR                     
//OSJOB         DD DSN=&&TEMP,DISP=(,PASS),UNIT=SYSDA,               
//        SPACE=(TRK,(3,1)),DCB=(RECFM=FB,BLKSIZE=3120)             
//SYSIN          DD *                                           
-OPT GPO                                                            
-DLM NAME=,EXEC(R)                                                  
-END                                                                
/*                                                                  
//STEP2         EXEC PGM=AFOLIBR,PARM='NRJS,NJTA'                   
//MASTER       DD  DSN=your.master.file,DISP=SHR                    
//OSJOB         DD    DUMMY                                          
//SYSPRINT    DD       SYSOUT=*                                    
//LIST            DD       SYSOUT=*                                    
//SYSIN          DD       DSN=&&TEMP,DISP=(OLD,DELETE)