Delete fixed-length KSDS Example


Scenario - Delete KSDS using the IDCAMS utility.

Code -

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

In the above JCL, MATEGJ.TEST.KSDS is the KSDS 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, KSDS successfully got deleted.

DELETE KSDS Output

Verify the KSDS in 3.4 (Dataset List utility) or any File management tools if required to double-check.

DELETE KSDS Output

Explaining Example -

In the above example, the MATEGJ.TEST.KSDS (KSDS 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.