Module 3: Access Method Services (AMS)
IDCAMS- ALTER Command
- IDCAMS- ALTER command is used to modify the attributes of an existing VSAM dataset
ALTER vsam-file-name[/password] - [ADDVOLUMES ( volser1 [volser2...]) ] - [BUFFERSPACE ( size ) ] - [ERASE | NOERASE] - [FREESPACE ( CI-percent [CA-percent]) ] - [INHIBIT | UNINHIBIT ] - [KEYS ( length offset ) ] - [NEWNAME (new-file-name)] - [RECORDSIZE ( average maximum )] - [REMOVEVOLUMES ( volser1 [volser2...]) ] - [TO (date) | FOR (days) ] ) - [CATALOG(catalog-name[/password])]
Note:- We have included only those parameters which are the most commonly used, For complete list of parameters you can refer IBM Manual:- here
- Above Syntax depicts the parameters which we can modify in existing VSAM cluster. The parameter meaning remains same as mentioned in ‘IDCAMS- DEFINE Cluster’ article. Below we have listed parameters which are available only with ALTER command:-
- This parameter is used to add the volumes.
- Syntax:- ADDVOLUMES ( volser1 [volser2...])
- INHIBIT | UNINHIBIT
- Specifies whether the entry being altered can be accessed for any operation or only for read operations.
- When specified INHIBIT, VSAM file will be modified to have read-only access
- When specified UNINHIBIT, it removes read-only restriction from VSAM file
- This parameter is used to rename the VSAM file
- Syntax:- NEWNAME (new-file-name)
- This parameter is used to remove the volumes.
- Syntax:- REMOVEVOLUMES ( volser1 [volser2...])
- It is important to know that all the attributes of existing VSAM cannot be changed with ALTER command like CONTROLINTERVALSIZE, Type of cluster, IMBED/REPLICATE, REUSE/NOREUSE
Use of ALTER command to rename ESDS file
Description: - Above code snippet will rename cluster ‘PAYT.PAYROLL.PRCSESDS.MSTR’ to ‘PAYT.PAYROLL.RENAME.MAIN’ and data component ‘PAYT.PAYROLL.PRCSESDS.MSTR.DATA’ to ‘PAYT.PAYROLL.RENAME.MAIN.DATA’.
IMP Note:- If you rename only CLUSTER, any associated data component and index component will not rename automatically. Thus, you have to ALTER them too
Use of ALTER command to make KSDS file read-only
Use of ALTER command to remove read-only restriction applied on KSDS file