Delete LDS Example


Scenario - Delete LDS using the IDCAMS utility.

JCL -

----+----1----+----2----+----3----+----4----+----5----+
//MATEGJD JOB (123),'MTH',CLASS=A,MSGCLASS=A,
//             MSGLEVEL=(1,1),NOTIFY=&SYSUID
//************************************************
//* DELETING LDS 
//************************************************
//STEP01   EXEC PGM=IDCAMS
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
      DELETE 'MATEGJ.TEST.LDS'
/*

In the above JCL, MATEGJ.TEST.LDS is the LDS name that is planned to delete.

Output -

Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, LDS successfully got deleted.

DELETE LDS Output

If required, verify the LDS in 3.4 (Dataset List utility) or any File management tools to double-check.

DELETE LDS Output

Explaining Example -

In the above example, the MATEGJ.TEST.LDS (LDS file) successfully deleted and uncatalogued(space released).

Note! If the file is already deleted and trying to delete the file again, we may receive MAXCC as 08. So, verify the file once before proceeding for delete.