Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 3: Access Method Services (AMS)


IDCAMS- ALTER Command

  • IDCAMS- ALTER command is used to modify the attributes of an existing VSAM dataset
  • Syntax:-
    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:-
    • ADDVOLUMES
      • 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 being will be modified to have read-only access
      • When specified UNINHIBIT, it removes read-only restriction from VSAM file
    • NEWNAME
      • This parameter is used to rename the VSAM file
      • Syntax:- NEWNAME (new-file-name)
    • REMOVEVOLUMES
      • 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

Example 1:-

Use of ALTER command to rename ESDS file

//ALTERES EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * ALTER PAYT.PAYROLL.PRCSESDS.MSTR - NEWNAME(PAYT.PAYROLL.RENAME.MAIN) ALTER PAYT.PAYROLL.PRCSESDS.MSTR.DATA - NEWNAME(PAYT.PAYROLL.RENAME.MAIN.DATA) /*

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’. Similarly, using the same code structure, you can also print ESDS, RRDS datasets

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

Example 2:-

Use of ALTER command to make KSDS file read-only

//ALTERKS EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * ALTER PAYT.PAYROLL.KSDS.MSTR.DATA - INHIBIT ALTER PAYT.PAYROLL.KSDS.MSTR.INDEX - INHIBIT /*

Example 3:-

Use of ALTER command to remove read-only restriction applied on KSDS file

//ALTERKS EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * ALTER PAYT.PAYROLL.KSDS.MSTR.DATA - UNINHIBIT ALTER PAYT.PAYROLL.KSDS.MSTR.INDEX - UNINHIBIT /*






© copyright mainframebug.com
Privacy Policy