Delete files (DELETE)


The DELETE command deletes catalogs, VSAM datasets, catalog entries, or both and non-VSAM datasets. It provides flexibility in choosing what to delete, allowing for the removal of just the dataset, the catalog entry, or both.

Syntax -

Deleting a Cluster or an AIX -

//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  DELETE  (entryname[ entryname ...])
  	[CLUSTER | ALTERNATEINDEX]
  	[ERASE | NOERASE]
  	[FORCE | NOFORCE]
  	[PURGE | NOPURGE]
  	[CATALOG(catname)]
/*

Deleting a Path -

//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  DELETE  (entryname[ entryname ...])
  	[PATH]
  	[PURGE | NOPURGE]
  	[CATALOG(catname)]
/*

Deleting a Catalog -

//JOBNAME  JOB job-card-parameters
//STEP01   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  DELETE  (entryname[ entryname ...])
	[MASTERCATALOG | USERCATALOG]
  	[PURGE | NOPURGE]
  	[CATALOG(catname)]
/*

Deleting a nonVSAM object -

//JOBNAME  JOB job-card-parameters
//STEP01   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  DELETE  (entryname[ entryname ...])
	[NONVSAM]
  	[PURGE | NOPURGE]
  	[SCRATCH | NOSCRATCH]
  	[CATALOG(catname)]
/*

Mandatory Parameters


  • (entryname[ entryname...]) - Specifies the name of entry to be deleted. If trying to delete more than one entry, those entry names must enclose the list of entry names in parentheses. The maximum entrynames can specify 100.

Optional Parameters


  • CLUSTER | ALTERNATEINDEX | PATH | MASTERCATALOG | USERCATALOG | NONVSAM - Specifies the object entry to be deleted.
  • ERASE | NOERASE - Default: NOERASE
    • ERASE - specifies the cluster components memory is to be erased with binary zeroes when cluster is deleted. Short Description: ERAS
    • NOERASE - specifies the cluster components memory is not to be erased when cluster is deleted. Short Description: NERAS
  • FILE(ddname) - Specifies the DD name associated with the dataset to be deleted. This is used primarily when the dataset is defined by a DD statement rather than a name in the catalog.
  • FORCE | NOFORCE -
    • FORCE - deletes entries, and user catalogs without checking that these entries are empty. Short Description: FRC
    • NOFORCE - deletes entries, and user catalogs only that entries are empty. Short Description: NFRC
  • PURGE | NOPURGE -
    • PURGE - Specifies the output objects should delete if the retention period has not expired. Short Description: PRG
    • NOPURGE - Specifies the output objects should not delete until the retention period has expired. Short Description: NPRG
  • SCRATCH | NOSEARCH -
    • SCRATCH - Specifies that both the catalog entry and the file are to be deleted. Short Description: SCR
    • NOSEARCH - specifies that the file being deleted is to keep its label in the VTOC. Short Description: NSCR
  • CATALOG (catalog-name) - Specifies the catalog in which the work files are to be defined. Short Description: CAT

Example -


Scenario - Deleting ESDS file.

Input ESDS File - MATEPK.TEST.ESDS

JCL -

----+----1----+----2----+----3----+----4----+----5----+
...
//STEP01   EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
      DELETE 'MATEPK.TEST.ESDS'
/*
...

Output -

Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, then DELETE is successful.

DELETE Sysprint

Verify the file in 3.4 (Dataset List utility) or any File management tools for the existance.