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).

The disposition to delete the dataset is DISP=(OLD,DELETE,..) or DISP=(MOD,DELETE,..).

DELETE option performs below two tasks -

  • Deletes an entry from 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 -

...
//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 - MATEPK.IEFBR14.PDS

JCL -

----+----1----+----2----+----3----+---4---+---5---+
...
//STEP01   EXEC PGM=IEFBR14
//DD1      DD DSN=MATEPK.IEFBR14.PSFILE,
//            DISP=(OLD,DELETE,DELETE)
//DD2      DD DSN=MATEPK.IEFBR14.PDS,
//            DISP=(OLD,DELETE,DELETE)
...