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 ). IDCAMS supports changing the 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.

ALTER command can’t change all the attributes from VSAM definition, whereas it can change most of the attributes.

High-level syntax -


//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  ALTER  dataset-name
  [parmeters-list]
/*

Detail 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)]
/*
Info! Most of the parameters are covered under DEFINE CLUSTER topic. Refer it for the complete information.

Parameters


The ALTER command uses to modify the dataset attributes, the mandatory and optional parameters are specified below.

Mandatory Parameters


dataset-name


  • dataset-name specifies the names of the dataset to be altered.
  • If the catalog attributes are altered, the dataset-name is the catalog name.
  • If altering the attributes of components, the dataset-name is the respective component names. For example, if the DATA component attributes are modified, we should specify the DATA component name.

Optional Parameters


ACCOUNT (account–info)


  • ACCOUNT used to change the accounting information and user data for SMS-managed VSAM or non-VSAM datasets.

Short Description: ACCT

ADDVOLUMES (volser [ volser])


  • ADDVOLUMES specifies the additional volumes that are to be added to the dataset.
  • ALTER ADDVOLUMES adds volumes to non-managed VSAM datasets and SMS-managed VSAM, non-VSAM, and generation data sets (GDS).
  • Suppose an ALTER ADDVOLUMES is done to an opened dataset. In that case, the dataset must be closed and reopened to reflect the newly added volumes.

Short Description: AVOL

BUFFERSPACE (size)


  • Specifies the amount of space to be added for buffers.

Short Description: BUFSP or BUFSPC

FILE (ddname)


  • Specifies the ddname that represents the dataset to be altered.

FILEDATA (TEXT|BINARY)


  • TEXT specifies the data in the dataset is text.
  • BINARY specifies the data to be processed as is.

INHIBIT | UNINHIBIT


  • INHIBIT specifies altered entry is accessed for read-only operation. Short Description: INH
  • UNINHIBIT removes the read-only constraint set by a previous ALTER or EXPORT command. Short Description: UNINH

NEWNAME (new-dataset-name)


  • NEWNAME specifies the new name of the entry.

Short Description: NEWNM

NULLIFY (parameters)


  • NULLIFY specifies the protection attributes to be nullified.

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

TYPE (LINEAR)


  • Specifies that the VSAM dataset type of an ESDS is to be changed to linear.

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.

Verify ESDS Alter

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.