DELETE command.


DELETE command in IDCAMS:

·        The DELETE command removes the entry for the specified object(s) from the catalog

·        Syntax:
DELETE (entryname[/password][ entryname[/password] ...])
    [ALIAS  |
    ALTERNATEINDEX  |
    CLUSTER  |
    GENERATIONDATAGROUP  |
    NONVSAM  |

    PAGESPACE  |
    PATH  |
    SPACE  |
    USERCATALOG

    [ERASE  |  NOERASE]
    [FILE(ddname)]
    [FORCE  |  NOFORCE]
    [PURGE  |  NOPURGE]
    [SCRATCH  |  NOSCRATCH]


    [CATALOG(catname[/password])] 

·        Thus we can see that after the delete statement, the name of the object is used, which is the  followed by the type of the OBJECT. Example:
GDG, ALIAS,CLUSTER etc.
This is later followed by the options.
·        Note that we can use this DELETE command to even delete NON-VSAM files.
·        The ERASE / NOERASE option may be specified to override the ERASE attributed specified for the object in the catalog. When ERASE is specified the space utilized is freed and id filled with Binary zeros.

·        The FORCE option may be specified to cause the deletion of specific objects (SPACE, USERCATALOG, GENERATIONDATAGROUP) even though they may be non-empty. This may be used to delete the GDG even if its versions exists.

·        The SCRATCH option may be specified to cause the associated entry for the object to be removed from the Volume Table of Contents.  This is most often applicable to non-VSAM datasets.

·        PURGE overcomes any retention of dataset conflicts.

Example 1: To delete a KSDS:
//JOB00008 JOB (XXXX),'ACCESS METHOD',NOTIFY=SYSUID           
//STEP0001 EXEC PGM=IDCAMS                                    
//SYSPRINT DD   SYSOUT=*                                      
//SYSIN    DD *                                               
 DELETE SM017R.TEST.VSAM1 CLUSTER FORCE          
 /* ABOVE DELETES IF THE KSDS EXISTS */                       
/*

1 comment:

  1. Hello thanks for sharing these information. but i need to know about Delete command in SQl, anyone can share here "Uses of delete command with example"

    ReplyDelete