TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

VSAM - Delete Cluster Syntax


VSAM cluster should be deleted using IDCAMS utility. The DELETE command removes the entry for the specified object(s) from the catalog and optionally removes the object, thereby freeing up the space occupied by the object (in the case of datasets residing on direct access storage).

Delete command is also used to delete Alias, Alternate index, GDG, Non VSAM datasets, pagespace, space, usercatalog.

Syntax:

DELETE data-set-name CLUSTER
    [ERASE / NOERASE]
    [FORCE / NOFORCE]
    [PURGE / NOPURGE]
    [SCRATCH / NOSCRATCH]
Explanation:
  • ERASE / NOERASE

    ERASE option is specified to override the ERASE attribute specified for the object in the catalog. NOERASE option is taken by default.

  • FORCE / NOFORCE

    FORCE option is specified to delete the SPACE and USERCATALOG even if they are not empty. NOFORCE option is taken by default.

  • PURGE / NOPURGE

    PURGE option is used to delete the VSAM dataset if dataset has not expired. NOPURGE option is taken by default.

  • SCRATCH / NOSCRATCH

    SCRATCH option is specified to remove the associated entry for the object from the Volume Table of Contents. It is mainly used for non-vsam datasets like GDGs. NOSCRATCH option is taken by default.


Let us see an example below for delete cluster.

//JOBNAME1 JOB CLASS=C,PRTY=10,MSGCLASS=C,MSGLEVEL=(1,1),NOTIFY=&SYSUID
//*
//STEP001  EXEC PGM=IDCAMS
//SYSPRINT DD  SYSOUT=*
//SYSIN    DD  *
   DELETE racfid.VSAM.KSDSFILE.TEST CLUSTER
	 PURGE
/*

If you execute the above JCL. Job should complete successfully with MAXCC = 0 and It will delete racfid.VSAM.KSDSFILE.TEST VSAM file.


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal