JCL

VSAM DELETE using IDCAMS with Examples

VSAM cluster should be deleted using IDCAMS utility. VSAM DELETE command can be used to delete the VSAM or non-VSAM objects such as CLUSTER, GDG, Alternate Index, Alias, CATALOG, PS file, SPACE, USERCATALOG, etc. DELETE command removes the entry of the VSAM cluster from the catalog and optionally removes the file & freeing up the space. If the VSAM is not expired then it will not be deleted. To delete non-expired datasets use the PURGE option.

DELETE (entryname[/password][ entryname[/password] ...])
[object-type] 
    [ALIAS  |
    ALTERNATEINDEX  |
    CLUSTER  |
    GENERATIONDATAGROUP  |
    NONVSAM  |
    PAGESPACE  |
    PATH  |
    SPACE  |
    USERCATALOG]
[optional-paramter]
    [ERASE  |  NOERASE]
    [FILE(ddname)]
    [FORCE  |  NOFORCE]
    [PURGE  |  NOPURGE]
    [SCRATCH  |  NOSCRATCH]
    [CATALOG(catname[/password])] 

Entry-name – The dataset name which needs to be deleted and the dataset name which needs to exist. If a single entry needs to be deleted then no parentheses are required. You can delete multiple file entries with the single DELETE command

Object-type – It can be ALIAS, ALTERNATEINDEX, CLUSTER, GENERATIONDATAGROUP, LIBRARYENTRY, NONVSAM, NVR, PAGESPACE, PATH, TRUENAME, USERCATALOG, VOLUMERNTRY or VVR.

Optional Parameters –

ParameterDescription
ERASE OR NOERASEUsed to specify whether the components of a cluster or alternate index to be deleted are to be erased(i.e. overwritten with binary zeroes)

If ERASE is specified then both the entry will be removed from the catalog and the data component will be immediately overwritten with binary zeroes.

If NOERASE is specified then entry will be removed from the catalog but components will not be overwritten with binary zeroes.
FORCE OR NOFORCEUsed to specify whether entries that are not empty should be deleted.

If FORCE is specified then it allows users to delete data spaces, GDGs, and user catalogs without ensuring that these objects are empty.

If FORCE is specified then it causes the DELETE command to terminate when you request the deletion of data space, GDGs, or catalog that is not empty.
PURGE OR NOPURGEUsed to specify whether the entry is to be deleted regardless of the retention period specified originally.

If PURGE is specified then the entry will be deleted even if the retention period is not expired.

If NOPURGE is specified then the entry will not be deleted if the retention period is not expired. This is the default option if nothing specified.
SCRATCH OR NOSCRATCHUsed to specify whether a data set is to be removed from the VTOC of the volume on which it resides.

If SCRATCH is specified then the entry will be removed from both catalog & VTOC.

If NOSCRATCH is specified then entry will be removed only from the catalog.

VSAM DELETE to delete KSDS file

//VSAMDELT JOB (1234),'INDUS',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID,REGION=6M                         
//*************************************************************
//* SAMPLE JCL DELETE VSAM DATASET
//*************************************************************
//STEP01  EXEC PGM=IDCAMS
//SYSPRINT  DD SYSOUT=*
//INPUT    DD   DSNAME=userid.KSDS.INPUT,DISP=SHR
//SYSIN    DD   *
   DELETE FILE (INPUT)   -
   PURGE
/*

VSAM DELETE to delete ESDS file

//VSAMDELT JOB (1234),'INDUS',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID,REGION=6M                         
//*************************************************************
//* SAMPLE JCL DELETE ESDS DATASET
//*************************************************************
//STEP01   EXEC PGM=IDCAMS                             
//SYSPRINT DD SYSOUT=*                                 
//SYSIN    DD *                                        
     DELETE XXXXXX.YYYYYY.VSAMFILE.MSTR           
/*  

The above code snippet will delete cluster ‘XXXXXX.YYYYYY.VSAMFILE.MSTR’ and associated data component ‘XXXXXX.YYYYYY.VSAMFILE.MSTR.DATA’ (even if we have not specified it explicitly). Similarly, using the same code structure, you can delete ESDS, RRDS datasets

Note: When you delete this CLUSTER all associated data components and index components will be deleted automatically.

VSAM Tutorials

VSAM Define Cluster: Click Here IBM Reference : Click Here

Admin

Share
Published by
Admin

Recent Posts

Increase Transparency and Collaboration Product Backlog

A well-maintained product backlog is crucial for successful product development. It serves as a single…

2 months ago

Product Backlog – Incremental value to the customer

Incremental value to the customer refers to the gradual delivery of small, functional parts of…

2 months ago

Product Market, Customer’s Desire, Need, and Challenges

A Product Market refers to the group of potential customers who might be interested in…

2 months ago

PAL-EBM Professional Agile Leadership – EBM Certification

The Professional Agile Leadership - Evidence-Based Management (PAL-EBM) certification offered by Scrum.org is designed for…

5 months ago

PAL I Professional Agile Leadership Certification

The Professional Agile Leadership (PAL I) certification, offered by Scrum.org, is designed to equip leaders…

5 months ago

Scrum Master Certification: CSM, PSM, SSM

Choosing the right Scrum Master Certification depends on your current experience and career goals. If…

7 months ago