Joined: 06 Dec 2004 Posts: 211 Location: Keane Inc., Minneapolis USA.
Hi All,
I need a help in formatting a CSV file by adding first record (Header) after each control break.
For example my input is as follows
custno,item,cost
1001,234,23.00
1001,437,87.00
1001,787,89.00
1002,777,20.00
1002,343,23.30
1003,778,09.00
1003,989,99.00
1003,999,99.00
Then output file should be BREAK on cust number (repeat headers for each customer change) output should be as follows
Further If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Joined: 06 Dec 2004 Posts: 211 Location: Keane Inc., Minneapolis USA.
Thanks for the reply. I got it in a different way but this looks optimized. One more question can we do this for a comma separated file with variable length fields.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
Yes. You can PARSE for the key field, add it to the record, temporarily, use the temporary field with whatever method you have chosen, and drop the temporary field before output.
If that doesn't get you there, post the details in a new topic, please.