DELETE Command (for Beginners)


The DELETE command is used to delete catalogs, VSAM datasets, and non-VSAM datasets.

Detailed syntax -


//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  DELETE 	(entryname[ entryname ...])
  	[ALIAS|
  	  ALTERNATEINDEX|
  	  CLUSTER|
  	  GENERATIONDATAGROUP|
  	  LIBRARYENTRY|
  	  NONVSAM|
  	  PAGESPACE|
  	  PATH|
  	  USERCATALOG|
  	  VOLUMEENTRY]
  	[ERASE|NOERASE]
  	[FILE(ddname)]
  	[FORCE|NOFORCE]
  	[MASK|NOMASK]
  	[PURGE|NOPURGE]
  	[RECOVERY|NORECOVERY]
  	[SCRATCH|NOSCRATCH]
  	[CATALOG(catname)]
/*

Parameters


The DELETE command mandatory and optional parameters are specified below -

Mandatory Parameters


Parameters Description
(entryname[ entryname...]) Specifies the entry name to be deleted.

Optional Parameters


Parameters Description
ALIAS | ALTERNATEINDEX | CLUSTER | GENERATIONDATAGROUP | LIBRARYENTRY | NONVSAM | PAGESPACE | PATH | USERCATALOG | VOLUMEENTRY Specifies the object type or entry to be deleted.
ERASE | NOERASE Specifies cluster components are to be overwritten with binary zeros or not when the cluster or AIX is deleted.
Short Description: ERAS | NERAS
FORCE | NOFORCE FORCE parameter deletes generation data groups, tape library entries, and user catalogs without ensuring that these entries are empty.
NOFORCE specifies the DELETE command to end when the deletion of a gdg, tape library entry, or user catalog is not empty.
Short Description: FRC | NFRC
PURGE | NOPURGE Specifies the entry is to be deleted or not even if the retention period has not expired.
Short Description: PRG | NPRG
SCRATCH | NOSCRATCH Specifies the catalog entry to be deleted with or without mounting the volume.
Short Description: SCR | NSCR

Example -


Requirement - Delete ESDS file.

Input ESDS File - MATEPK.TEST.ESDS

Code -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKD JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),            
//             NOTIFY=&SYSUID                                           
//************************************************************          
//* DELETING ESDS                                                       
//************************************************************          
//STEP01   EXEC PGM=IDCAMS                                              
//SYSPRINT DD   SYSOUT=*                                                
//SYSIN    DD   *                                                       
      DELETE 'MATEPK.TEST.ESDS'                                         
/*                                                                      
**************************** Bottom of Data ****************************

In the above JCL, MATEPK is the userid and change it as required.

Output -

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

********************************* TOP OF DATA **********************************
IDCAMS  SYSTEM SERVICES                                           TIME: 07:58:53
                                                                                
      DELETE 'MATEPK.TEST.ESDS'                                                 
IDC0550I ENTRY (D) MATEPK.TEST.ESDS.DATA DELETED                                
IDC0550I ENTRY (C) MATEPK.TEST.ESDS DELETED                                     
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0                       
                                                                                
IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0               
******************************** BOTTOM OF DATA ********************************

Verify the path in 3.4 (Dataset List utility) or any File management tools.