Is it possible to change the record length of a PS

JES2/3, JCL, utilities.
Post Reply
pinball
Registered Member
Posts: 26
Joined: Sun Jul 07, 2013 1:28 am

Is it possible to change the record length of a PS

Post by pinball »

Hello,

Is it possible to change the record length of a sequential file that i have already defined?
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

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

Post 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.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

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

Post 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.
Regards
Nic
User avatar
Anuj Dhawan
Founder
Posts: 2799
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

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

Post 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.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

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

Post 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
zprogrammer
enrico-sorichetti
Global Moderator
Global Moderator
Posts: 825
Joined: Wed Sep 11, 2013 3:57 pm

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

Post 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 !
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort 8-)
pinball
Registered Member
Posts: 26
Joined: Sun Jul 07, 2013 1:28 am

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

Post 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.
pinball
Registered Member
Posts: 26
Joined: Sun Jul 07, 2013 1:28 am

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

Post 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.
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

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

Post 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?
zprogrammer
William Collins
Global Moderator
Global Moderator
Posts: 490
Joined: Sun Aug 25, 2013 7:24 pm

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

Post 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...
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

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

Post 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.
Regards
Nic
pinball
Registered Member
Posts: 26
Joined: Sun Jul 07, 2013 1:28 am

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

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “JCL - Job Control Language.”