How to Delete VSAM Secondary Index

Indexes like data sets takes memory. Here is a sample logic how we deleted secondary index of VSAM file.

What is secondary index

You call it alternative index. RRDS, ESDS and KSDS can have alternative index. But primary index you can define only on KSDS.

A KSDS has two parts: the index component and the data component. These will store on separate disk volumes.

While a basic KSDS only has one key (the primary key), alternate indices may be defined to permit the use of additional fields as secondary keys. An Alternate Index (AIX) is itself a KSDS. The data structure used by a KSDS is nowadays known as a B+ tree.

How to delete Secondary index

While deleting a Cluster by using IDCAMS, it deletes internally all cluster, secondary index and path. So, you no need to delete all these separately.

More: What is relation between alternative index and Path

Logic to Delete Secondary Index

//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
 DELETE test.vsam.file CLUSTER
/*

More: Top Example IDCAMS JCL

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.