OUTREC has no special power. It is the same as INREC (assuming DFSORT), but operates after SORT/MERGE. Without SORT/MERGE, use INREC.
FIELDS is old and overloaded. Use BUILD instead. BUILD is a synonym for FIELDS, so operation is 100% identical, but it is not overloaded: when you see BUILD on INREC, OUTREC and OUTFIL it is less confusing than seeing FIELDS, FIELDS and OUTREC, and also seeing FIELDS on SORT/MERGE, REFORMAT, SUM, etc.
Those are tips. They don't affect what you want.
Assuming that you can guarantee groups of three records (or four if that blank is really there), it is WHEN=GROUP that you want.
You'll need to temporarily add a sequence number to the record. When it is exactly divisible by three (or four) , WHEN=GROUP to identify that and PUSH the data you want from the first record at to an extension of the record, with RECORDS=3.
When it is divisible by three (or four) with remainder one, WHEN=GROUP to identify that and PUSH the data you want from the second record to a separate extension.
When it is divisible with remainder two, use BUILD to format the output that you want from the three pieces of data that you have access to at the time: the third record; the data PUSHed from the first record; the data PUSHed from the second record.
Use OUTFIL INCLUDE=/OMIT= to select the third record of each group. If there is a blank record that you need, you can either INCLUDE=/OMIT= that as well, or generate it on a BUILD in OUTFIL using the slash operator (/).
Look for the DFSORT Getting Started manual, it is aimed exactly at people in your situation and has many useful examples. Full details of everything are in the DFSORT Application Programming Guide.
Thanks William for useful insights and suggestions. I was side tracked untill i came across again same task last week.
I got around the situation using the ICETOOL. Again it was first attempt for me in ICETOOL but it's really useful. I used temp seq no. and ID field before creating Output. And the actual data pos i gave in WITH parameters. I needed a CSV output, so added a , after each block while creating outrec.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum