Summary -

In this topic, we described about the Delete Datasets with detailed example.

IEFBR14 can be used to delete the datasets. The dataset can be either Sequential file(PS) or Partitioned Dataset(PDS).

Syntax -

//Job Card
//*
//STEP1    EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSDUMP  DD SYSOUT=*
//DD1      DD DSN=datset.name, DISP=(OLD,DELETE,DELETE)

Example: -

Below example to delete the PS and PDS using IEFBR14 utility.

JCL: -

----+----1----+----2----+----3----+---4---+---5---+---6---+---7--
***************************** Top of Data ****************************
//MTHUSRD  JOB (123),'MTHUSR',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),        
//             NOTIFY=&SYSUID                                           
//********************************************************************
//* DELETE A DATA SET USING IEFBR14 UTILITY                             
//********************************************************************
//STEP20   EXEC PGM=IEFBR14                                             
//SYSPRINT DD SYSOUT=*                                                  
//SYSOUT   DD SYSOUT=*                                                  
//SYSDUMP  DD SYSOUT=*                                                  
//DD1      DD DSN=MTHUSR.TEST.PSFILE,                                   
//            DISP=(OLD,DELETE,DELETE)                                  
//DD2      DD DSN=MTHUSR.TEST.PDSFILE,                                  
//            DISP=(OLD,DELETE,DELETE)                                  
//*                                                                     
**************************** Bottom of Data **************************

Delete Datasets

Output: -

Delete Datasets

Explaining Solution: -

  • SYSPRINT - Used by utility programs for their output.
  • SYSOUT - Specifies system defined dd name used for file status codes, system abend codes information and output of the display statement.
  • SYSDUMP - Used by the system for dumping when an abend occurs that causes a system dump.
  • DD1 DD - Specifies PS dataset with DISP for deletion (DISP=(OLD,DELETE,DELETE)).
  • DD2 DD - Specifies PDS dataset with DISP for deletion (DISP=(OLD,DELETE,DELETE)).