Delete Datasets


  • ISPF foreground option 3.2 (Data Set Utility panel) is also used to delete the datasets. However, the IEFBR14 utility is used to delete the datasets as part of a batch run.
  • The dataset can be either a Sequential file(PS) or Partitioned Dataset(PDS).
  • IEFBR14 can be used to delete the sequential file (PS) or partitioned dataset (PDS).
  • The disposition to delete the dataset is DISP=(OLD,DELETE,..) or DISP=(MOD,DELETE,..).

DELETE option performs below two tasks -

  • Deletes an entry in the system or user catalog directory for the dataset.
  • Removes the dataset entry from VTOC (Volume Table of Contents), and it cant be retrieved.
  • Removes all the required indexes that are required to access the dataset.

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 -


Scenario - Delete the PS and PDS using IEFBR14 utility.

Input PS File - MATEPK.IEFBR14.PSFILE
Input PDS File - MATEPK.IEFBR14.PDSFILE

JCL -

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

Output -

Go to Spool (SDSF -> ST) and verify the status in the JESYSMSG DDname of the corresponding job.

********************************* TOP OF DATA **********************************
ICH70001I MATEPK   LAST ACCESS AT 11:22:37 ON SATURDAY, AUGUST 20, 2022         
IEF236I ALLOC. FOR MATEPKD STEP01                                               
IEF237I 0ABB ALLOCATED TO DD1                                                   
IEF237I 0ABB ALLOCATED TO DD2                                                   
IEF142I MATEPKD STEP01 - STEP WAS EXECUTED - COND CODE 0000                     
IEF285I   MATEPK.IEFBR14.PSFILE                        UNCATALOGED              
IEF285I   VOL SER NOS= DEVHD4.                                                  
IEF285I   MATEPK.IEFBR14.PSFILE                        DELETED                  
IEF285I   VOL SER NOS= DEVHD4.                                                  
IEF285I   MATEPK.IEFBR14.PDSFILE                       UNCATALOGED              
IEF285I   VOL SER NOS= DEVHD4.                                                  
IEF285I   MATEPK.IEFBR14.PDSFILE                       DELETED                  
IEF285I   VOL SER NOS= DEVHD4.                                                  
IEF373I STEP/STEP01  /START 2022232.1124                                        
IEF032I STEP/STEP01  /STOP  2022232.1124                                        
        CPU:     0 HR  00 MIN  00.01 SEC    SRB:     0 HR  00 MIN  00.00 SEC    
        VIRT:     4K  SYS:   228K  EXT:        0K  SYS:    13476K               
IEF375I  JOB/MATEPKD /START 2022232.1124                                        
IEF033I  JOB/MATEPKD /STOP  2022232.1124                                         
        CPU:     0 HR  00 MIN  00.01 SEC    SRB:     0 HR  00 MIN  00.00 SEC    
******************************** BOTTOM OF DATA ******************************** 

Explaining Example -

  • DD1 DD * - Specifies PS dataset with DISP for catalog (DISP=(OLD,CATLG,DELETE)).
  • DD2 DD * - Specifies PDS dataset with DISP for catalog (DISP=(OLD,CATLG,DELETE)).
  • IEF142I MATEPKD STEP01 - STEP WAS EXECUTED - COND CODE 0000 - Specifies the step01 completed successfully.
  • MATEPK.IEFBR14.PSFILE  UNCATALOGED - Specifies the MATEPK.IEFBR14.PSFILE uncataloged successfully.
  • MATEPK.IEFBR14.PSFILE  DELETED - Specifies the MATEPK.IEFBR14.PSFILE deleted successfully.
  • MATEPK.IEFBR14.PDSFILE  UNCATALOGED - Specifies the MATEPK.IEFBR14.PDSFILE uncataloged successfully.
  • MATEPK.IEFBR14.PDSFILE  DELETED - Specifies the MATEPK.IEFBR14.PDSFILE deleted successfully.