Change File Attributes (ALTER)


We never know how many records will be stored in the file during creation. So we 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 existing VSAM file. It can’t change all the attributes from VSAM definition, whereas it can change most of them.

Syntax -

//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  ALTER  entry-name
  	[ADDVOLUMES(volser[ volser...])]
  	[BUFFERSPACE(size)]
  	[ERASE | NOERASE]
  	[FREESPACE (CI-percent[ CA-percent])]
	[INHIBIT | UNINHIBIT]
  	[KEYS(length  offset)]
  	[NEWNAME(newname)]
  	[NULLIFY(parameters)]
  	[OWNER(ownerid)]
  	[RECORDSIZE(average  maximum)]
  	[REMOVEVOLUMES(volser[ volser...])]
  	[SHAREOPTIONS(crossregion[ crosssystem])]
  	[TO(date)|FOR(days)]
  	[UNIQUEKEY|NONUNIQUEKEY]
  	[UPDATE|NOUPDATE]
  	[UPGRADE|NOUPGRADE]
	[USERCATALOG]
	[WRITECHECK|NOWRITECHECK]
	[CATALOG (catname)]
/*

Mandatory Parameters


  • entry-name - specifies the name of the entry that can be Cluster, AIX, DATA, INDEX, and path.

Optional Parameters


  • ADDVOLUMES (volser [ volser]) - specifies the additional volumes that are to be added to the dataset. 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
  • ERASE | NOERASE - Default: NOERASE
    • ERASE - specifies the cluster components memory is to be erased with binary zeroes when cluster is deleted. Short Description: ERAS
    • NOERASE - specifies the cluster components memory is not to be erased when cluster is deleted. Short Description: NERAS
  • FREESPACE (CI-percent[ CA-percent]|0 0) - Specifies the percentage of each control interval and control area to leave free for future insertions. Short Description: FSPC. Default: FREESPACE (0 0)
  • INHIBIT | UNINHIBIT - Specifies the type of access constaint applies to the file. The available types are - INHIBIT (Applies read-only constraint. Short Description: INH), UNINHIBIT (removes read-only constraint. Short Description: UNINH).
  • KEYS (length offset | 64 0) - specifies the primary key field in the data record. It specifies key length and its displacement (in bytes) positions from the offset of the record. Default: KEYS (64 0)
  • NEWNAME (new-dataset-name) - specifies the new name of the entry. Short Description: NEWNM
  • NULLIFY (parameters) - specifies the attributes to be nullified.
  • OWNER (ownerid) - specifies the owner being altered for the entry.
  • RECORDSIZE (average maximum|default) - specifies the average and maximum lengths of the records in bytes. The minimum record size is 1 byte. Short Description: RECSZ
  • REMOVEVOLUMES (volser[ volser]) - specifies volumes to be removed associated with the dataset. Short Description: RVOL
  • SHAREOPTIONS (crossregion[ crosssystem]|1 3) - defines how the dataset can be shared among different regions and systems. Short Description: SHR. Default: SHR (1 3). crossregion specifies the amount of sharing allowed among regions. Valid values are 1 to 4. crosssystem option specifies the amount of sharing allowed among systems. Valid values are 1 to 4.
  • TO (date) | FOR (days) - specifies the retention period for the cluster. If neither TO nor FOR is used, the cluster can be deleted at any time.
  • UNIQUEKEY | NONUNIQUEKEY -
    • UNIQUEKEY - ensures all keys are unique. Short Description: UNQK
    • NONUNIQUEKEY - allows duplicate keys. Short Description: NUNQK
  • UPDATE | NOUPDATE -
    • UPDATE - specifies that the alternate index should be updated when changes are made to the base cluster. Short Description: UPD
    • NOUPDATE - specifies that the path is not reused after being deleted. Short Description: NUPD
  • UPGRADE | NOUPGRADE -
    • UPGRADE - ensures the AIX is automatically updated when changes happend in the base cluster. Short Description: UPG
    • NOUPGRADE - specifies no automatic updates to AIX for changes in the base cluster. Short Description: NUPG
  • WRITECHECK | NOWRITECHECK - specifies twhether the cluster or component is to be reviewed when a record is being written into it. Short Description: WCK or NWCK
  • CATALOG (catalog-name) - Specifies the catalog in which the work files are to be defined. Short Description: CAT

Example -


Scenario - Alter the ESDS file to the new name.

Input ESDS File - MATEPK.TEST.ESDS

JCL -

----+----1----+----2----+----3----+----4----+----5----+
...
//STEP01   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD  *
  ALTER MATEPK.TEST.ESDS    -
        NEWNAME (MATEPK.EMPL.ESDS1)
  ALTER MATEPK.TEST.ESDS.*  -
        NEWNAME (MATEPK.EMPL.ESDS1.*)
/*
...

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.

ALTER OUTPUT

Verify the path and AIX loaded in 3.4 (Dataset List utility) or any File management tools.

Verify ESDS Alter