Page 1 of 1

SORT JCL to modify input file

PostPosted: Tue Jun 07, 2016 4:42 pm
by nishantsinghal
Hi Mainframers,

I need your help to modify my input file as per my specific requirement. I have to do it through JCL only and I can not use COBOL/REXX/SAS.

I/P File - Record length 80 Bytes

File has some details in first few lines and then count of records at some fixed position (suppose 50)...See file below

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA


No of records in file 1 - 2000
No of records in file 2 - 4000
No of records in file 3 - 1000
No of records in file 4 - 3000
No of records in file 5 - 2000


O/P File: Record Length - 80 Bytes (Everything would remain same in O/P file except the count of No. of records...requirement is to subtract 1 from the no. of records)

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA


No of records in file 1 - 1999
No of records in file 2 - 3999
No of records in file 3 - 999
No of records in file 4 - 2999
No of records in file 5 - 1999


Please provide your suggestion and if requirement is still not clear then please let me know, will try to explain it in better way.

Regards,
Nishant Singhal

Coded, FWIW

Re: SORT JCL to modify input file

PostPosted: Tue Jun 07, 2016 5:09 pm
by Aki88
nishantsinghal wrote:I have to do it through JCL only and I can not use COBOL/REXX/SAS.


If above is the final word for the requirement; then - sorry, you're out of luck - because JCL by itself doesn't really do anything.
Instead, if you were looking for help with a program (for instance DFSORT/SYNCSORT etc) - which can be run through JCL to satify the requirement, then maybe there is still some hope.

Re: SORT JCL to modify input file

PostPosted: Tue Jun 07, 2016 7:31 pm
by Aki88
Follow-on to the last post; in case you do think of using a SORT product for the requirement, then look at 'INREC IFTHEN=(WHEN' coupled with BUILD, using 'SUB' function.

Re: SORT JCL to modify input file

PostPosted: Tue Jun 07, 2016 8:35 pm
by NicC
You used SORT in your topic title so why did you not post in the sort part of the forum?

Moving to DFSort. If your sort product is Syncsort then it can be moved again.

Re: SORT JCL to modify input file

PostPosted: Tue Jun 07, 2016 11:25 pm
by nishantsinghal
Aki88

I am okay with DFSORT/SYNCSORT/ICETOOL program but I am not suppose to use any new COBOL/REXX/SAS.

I would be great if you can provide me the exact sort card for my requirement but it does not mean I am not trying myself to get the desired results. Thanks!

NicC,

Just to give subject to my query, I used SORT otherwise its not specific to SORT program only. Please move it to appropriate location, I do not have any objection. Thanks!

Re: SORT JCL to modify input file

PostPosted: Wed Jun 08, 2016 3:00 am
by BillyBoyo
As Aki88 has noted already, use IFTHE=(WHEN=(logical expression) to identify the records you want to change, and then use OVERLAY to just change the field you want, with SUB. Make sure you specify a length for the result.

Re: SORT JCL to modify input file

PostPosted: Wed Jun 08, 2016 4:00 am
by NicC
Well, JCL does not manipulate data - you need a program of some kind be it written by you or a utility eg your sort product.
Your examle input and output does not appear to contain any count whatsoever. And what are datasets 1-5? Are they to be processed in one execution one file per execution? Do all the files have the same characteristics? And why are you mangling record counts? If these are production datasets then you should have an audit report of the changes. Also, how did a program that did not count correctly get ito production? If they are testing then why not go and change them by hand?