ALTER Command (for Beginners)
Summary
For extensive information, go through the ALTER Command (for Experienced)
We never know how many records will be stored in the file during creation. So we might always create a VSAM file with an average number of primary or secondary quantities. After some time, the memory is not sufficient to store the records. In this case, the file needs to be recreated ( backup data, delete the file, create with modified parameters, and copy data back). IDCAMS supports changing the existing VSAM file parameters using the ALTER command rather than doing all the above steps.
ALTER command is used to change the attributes of the VSAM dataset which was already created.
Detailed syntax -
//JOBNAME JOB job-card-parameters
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
ALTER dataset-name
[ACCOUNT(account–info)]
[ADDVOLUMES(volser[ volser...])]
[BUFFERSPACE(size)]
[EMPTY|NOEMPTY]
[ERASE|NOERASE]
[FILE(ddname)]
[FILEDATA(TEXT|BINARY)]
[FREESPACE(CI-percent[ CA-percent])]
[INHIBIT|UNINHIBIT]
[KEYS(length offset)]
[NEWNAME(newname)]
[NULLIFY(parameters)]
[OWNER(ownerid)]
[PURGE|NOPURGE]
[RECORDSIZE(average maximum)]
[REMOVEVOLUMES(volser[ volser...])]
[REUSE|NOREUSE]
[SHAREOPTIONS(crossregion[ crosssystem])]
[TO(date)|FOR(days)]
[TYPE(LINEAR)]
[UNIQUEKEY|NONUNIQUEKEY]
[UPDATE|NOUPDATE]
[UPGRADE|NOUPGRADE]
[CATALOG(catname)]
/*
Parameters
The ALTER command uses to modify the dataset attributes, the mandatory and optional parameters are specified below.
Mandatory Parameters
Parameters | Description |
---|---|
dataset-name | dataset-name specifies the names of the dataset to be altered. |
Optional Parameters
Parameters | Description |
---|---|
ADDVOLUMES (volser [ volser]) | ADDVOLUMES specifies the additional volumes that are to be added to the dataset. Short Description: AVOL |
NEWNAME (new-dataset-name) | NEWNAME specifies the new name of the entry. Short Description: NEWNM |
OWNER (ownerid) | OWNER specifies the owner being altered for the entry. |
REMOVEVOLUMES (volser[ volser]) | REMOVEVOLUMES specifies volumes to be removed associated with the dataset. Short Description: RVOL |
Example -
Requirement - Alter the ESDS file to the new name.
Input ESDS File - MATEPK.TEST.ESDS
Code -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKA JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//************************************************************
//* RENAME ESDS FILE TO NEW NAME
//************************************************************
//STEP01 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
ALTER MATEPK.TEST.ESDS -
NEWNAME (MATEPK.EMPL.ESDS)
ALTER MATEPK.TEST.ESDS.* -
NEWNAME (MATEPK.EMPL.ESDS.*)
/*
**************************** Bottom of Data ****************************
In the above JCL, MATEPK is the userid and change it as required.
Output -
Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, then alter is successful.
********************************* TOP OF DATA **********************************
IDCAMS SYSTEM SERVICES TIME: 03:22:32
ALTER MATEPK.TEST.ESDS -
NEWNAME (MATEPK.EMPL.ESDS)
IDC0531I ENTRY MATEPK.TEST.ESDS ALTERED
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
ALTER MATEPK.TEST.ESDS.* -
NEWNAME (MATEPK.EMPL.ESDS.*)
IDC0531I ENTRY MATEPK.TEST.ESDS.DATA ALTERED
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0
IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 0
******************************** BOTTOM OF DATA ********************************
Verify the path and AIX loaded in 3.4 (Dataset List utility) or any File management tools.

Explaining Example -
In the above example,
- ALTER MATEPK.TEST.ESDS specifies the old base cluster (ESDS) name.
- NEWNAME (MATEPK.EMPL.ESDS) specifies the new name of the base cluster.
- ALTER MATEPK.TEST.ESDS.* specifies the high-level qualifier for the components (DATA, INDEX) of the old cluster to rename.
- NEWNAME (MATEPK.EMPL.ESDS.*) specifies the new high-level qualifier for the components.