I want the output files to be split as shown below based on the third column. All columns are of fixed length.
o/p FILE1:
1234567 890123 200812
1234567 890123 200812
Joined: 01 Sep 2006 Posts: 39 Location: Chennai, India
Hi Krishna,
Thanks for your reply.
This is one way to achieve it if know the values in the third column.
Is there any other way to achieve it if we don't know the values in the third column. But the number of distinct values in the third column is known say 10. So we need to split the file into 10 files based on the third column without knowing the values in the third column.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
vinothsubramanian,
I am assuming that your input file is already sorted on your third column. If not change the SORT FIELDS=COPY to SORT FIELDS=(16,6,CH,A). you can easily tag an ID number to the third column using the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) and use that ID to split the records into different files like this:
If you have more than 10 unq values the leftover file will have all the other records
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
vinothsubramanian,
Here's another way of achieving the same without using 'WHEN=GROUP'. As pointed out by Kolusu, your input data seems to be sorted on third field.
If not, you might want to modify the SORT statement.
Joined: 01 Sep 2006 Posts: 39 Location: Chennai, India
Hi Kolusu,
Thanks for your reply. As pointed by you, the WHEN=GROUP didn't work in our system.
Hi arcvns,
The reply posted by you works exactly the way I wanted. Thanks for the solution. However could you please kindly explain me what does this line exactly does:
105:SEQNUM,8,ZD,97:81,8,ZD,SUB,105,8,ZD,M11,LENGTH=8
Thanks to both of you once again for helping to resolve this request.
The above piece of code overlays a sequence no. at pos-105 which is again subtracted from the sequence number already present at pos-81 and the result is formatted into 8 digit numeric with leading zeros at pos-97.
You have not mentioned your sort product. If you still have any queries on the keywords used, I would suggest going through the product manuals.
In case if you dont have a manual and
If you have SyncSort: Contact SyncSort support or send a PM to Alissa Margulies. I m sure the'll guide you further.
If you have DFSORT: The link to the manual is available in the "IBM Manuals" on the top of this screen.