Page 1 of 1

Increase the length in VSAM.

Posted: Mon Nov 09, 2015 1:34 pm
by hp123
Hi All,

If we want to increase the length of the VSAM, how can we do this?

I have done it using File-aid but interviewer wanted to ask some toerh way. How is it possibe to increase the length?

The question was about KSDS but can there be similar ways for other VSAM files?



Regards

Re: Increase the length in VSAM.

Posted: Mon Nov 09, 2015 6:40 pm
by Robert Sample
Unload the VSAM data set. Delete / define the VSAM data set with the new parameters. Reload the VSAM data set.
This is the usual and recommended way to make changes to record length -- for VSAM or any other data set.

Re: Increase the length in VSAM.

Posted: Fri Dec 04, 2015 11:29 am
by hp123
Is there no tool which can right way update the VSAM itself, Robert?
Robert Sample wrote:for VSAM or any other data set.
What other data sets are you talking about?

Re: Increase the length in VSAM.

Posted: Fri Dec 04, 2015 4:39 pm
by nicc
What other data sets are you talking about?
ANY other dataset that one is trying to update - unless, of course, you do not mind being sacked if you corrupt the data irretrievably.

Re: Increase the length in VSAM.

Posted: Sat Dec 05, 2015 5:44 am
by Robert Sample
A data set can be VSAM (which in turn can be sequential, indexed, relative record, or linear), or sequential (PS), or partitioned (PO), or a LIBRARY (a newer partitioned), or direct access (DA). Depending on the age of the system you are using, indexed sequential (IS) could be possible (but not likely as it's been many years since IBM supported ISAM data sets).

And there might be tools on the market to redefine VSAM data sets on the fly -- but any such tool may potentially have to unload the data, delete and redefine the data set, then reload the data. It is possible, for variable length VSAM data sets, to use an ALTER to allow a longer length record but this will not work to make the record length shorter, nor does it do any good for fixed length record VSAM data sets. And the existing records will NOT have their record lengths increased -- only new records can have the longer lengths. And if you are wanting to change a KSDS index record length, ALTER cannot do that. The Access Method Services for Catalogs manual in the DFSMS bookshelf, which has all the IDCAMS commands, has a lot of restrictions on changing RECORDSIZE with ALTER:
Restrictions: RECORDSIZE is used only if all the following are true:
The object whose entry is being altered is an alternate index, a cluster, a path, or a data component.
The object whose entry is being altered contains no data records.
The maximum RECORDSIZE in the object's catalog entry is the default. For defaults, see the DEFINE command for the object.
If NONUNIQUEKEY is used for an alternate index, the record length to be specified accounts for the increased record size; this results from the multiple prime key pointers in the alternate index data record.
Use a maximum record length of at least seven bytes less than the control interval size, unless the record is a spanned record.
Use a record length large enough to contain all prime and alternate keys previously defined.
If RECORDSIZE in the object's catalog entry is not the default, and ALTER RECORDSIZE specifies that same value, processing continues for any other parameters given in the command, and there is no error message.
Note a key restriction -- if there is a single data record, you cannot use ALTER and must unload the VSAM data set.

The general method, which works for everything, is to unload / delete / define / reload the VSAM data set.