Page 1 of 1

Is it possible to change the record length of a PS

Posted: Mon Apr 28, 2014 4:19 pm
by pinball
Hello,

Is it possible to change the record length of a sequential file that i have already defined?

Re: Is it possible to change the record length of a PS

Posted: Mon Apr 28, 2014 4:52 pm
by William Collins
Yes. However, without some clue as to what you want to do, it is difficult to say anything beyond that. Once we know what you want, the answer may become No, or may remain Yes, but with additional details.

Re: Is it possible to change the record length of a PS

Posted: Mon Apr 28, 2014 6:46 pm
by nicc
If your dataset is empty then simply delete it and redefine it.
If it has data in it that needs to be of the new record length then you will have to write something - possibly a sort - to read the old data, reformat it to the new format and write it out to a new dataset with the new dataset attributes. Once successful the old dataset can be deleted and the new one renamed to the old name. You will, of course, have to change any program that writes, reads or updates that dataset.

Re: Is it possible to change the record length of a PS

Posted: Mon Apr 28, 2014 7:05 pm
by Anuj Dhawan
Welcome to the Forums, Nic - nice to see you here! :)

To the question in the thread - I'd like to start with "No" - No. A new data-set with the other LRECL will have to be cataloged first, then the data from the original file can be copied in though as William said, follow up explanation might change the answer.

Re: Is it possible to change the record length of a PS

Posted: Mon Apr 28, 2014 7:25 pm
by zprogrammer
IIRC there is a tool called STARTOOL if your shop uses that you could achieve it through that...

or

If the file is of GDG type then could create a new generation with different LRECL too

Re: Is it possible to change the record length of a PS

Posted: Mon Apr 28, 2014 7:54 pm
by enrico-sorichetti
If the file is of GDG type then could create a new generation with different LRECL too
pretty bad practice IMO ...

all the generations of a GDG should have the same dataset attributes !

Re: Is it possible to change the record length of a PS

Posted: Wed Apr 30, 2014 4:32 pm
by pinball
I have the file in step1 of lrecl=80 and in some other JCL I want to modigy it to lrecl=90, this is what I wanted to ask. Sorry for any confusion.

Re: Is it possible to change the record length of a PS

Posted: Wed Apr 30, 2014 4:36 pm
by pinball
Pandora-Box wrote:IIRC there is a tool called STARTOOL if your shop uses that you could achieve it through that...
We don't have STARTOOL.

Re: Is it possible to change the record length of a PS

Posted: Wed Apr 30, 2014 4:42 pm
by zprogrammer
When you say you wanted to you wanted to modify lrecl=80 to 90 in another step what will the extra 10 bytes contain ??

And also in how many different place is the file with LRECL=80 is being used?

Re: Is it possible to change the record length of a PS

Posted: Thu May 01, 2014 1:15 pm
by William Collins
The LRECL is just a piece of commentary. It is the maximum length of a logical record in a dataset.

If you want to "change" that, there is absolutely and utterly, utterly, no problem in doing so. Whether your data can still be read, depends on the data and what you are trying to read it with.

For instance, if you were using SORT, you could always specify a larger LRECL and process your data with no problem.

With a COBOL program you may run into problems.

Of course, this is not really what you want to do anyway. You want to make your records 10 bytes longer. You want to change the record-length of all the individual records (which have record-lengths, explicit or implicit) rather than "a PS", which does not have a record-length.

Terminology...

Re: Is it possible to change the record length of a PS

Posted: Thu May 01, 2014 1:32 pm
by nicc
I do not understand what the real problem is as it has not been explained as to why 10 more bytes are required. Assuming the requirement is to amend an existing dataset then the simplest way is to change the program that creates the dataset to declare the dataset as being 90 bytes record length, change the record declarations to the new length with the new/extended fields, assign data to those fields, change the record length in the JCL and change any downstream program that needs to read that dataset.

Re: Is it possible to change the record length of a PS

Posted: Thu Dec 10, 2015 2:40 pm
by pinball

Code: Select all

//CHNLEN     EXEC PGM=SORT 
//SORTIN   DD DISP=SHR,DSN=old.dataset 
//SORTOUT  DD DSN=new.dataset,DISP=(,CATLG,DELETE),... 
//SYSOUT   DD SYSOUT=* 
//SYSIN    DD * 
  OPTION COPY 
  OUTREC FIELDS=(1,80,90:X) 
/*


And this also worked, enter '/' beside the PS and choose option 17(copy). It will ask for DSname(give any). You will get 2 options as below
1. Allocate using same attributes
2. specify your own attributes
Selected '2' option from the above and changed the LRECL as needed.

The reason was change in requirements where we needed longer LRECL for a newly defined dataset. The work was half way through so we thought of having a shortcut method.