If I m not wrong.... Its a two step approach,
1> Firstly I/P file have to be divided into three files containing records according to their rec number.
In this case First File having Rec Number 1, 4, 7, 10...onwards.
Second File ...2, 5, 8, 11.....
Third File ....3, 6, 9, 12.......
DFSORT's SPLIT verb can be used for this to achieve.
2> Second step is to combine the records from three file into one file, i.e. O/P File, for that another field can be added in the files as rec number.
Then recs from the three files can be combined basis on rec number.
DFSORT's SPLICE should be used for that.
Frank.... Do we have any other direct step for this......
Here's a much more efficient way to do this with DFSORT's ICETOOL:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=... output file (FB/80)
//TOOLIN DD *
* Reformat each set of three records to:
COPY FROM(IN) TO(T1) USING(CTL1)
* Splice the records on seqnum to get:
* Remove seqnum
SPLICE FROM(T1) TO(OUT) ON(81,5,ZD) -
WITHEACH WITH(4,3) WITH(7,3) USING(CTL2)
//CTL1CNTL DD *
* Add seqnum1 in 81-85
* Get x=seqnum1//3 in 81-85
* If x=0, reformat the input record to:
* If x=1, reformat the input record to:
* If x=2, reformat the input record to:
//CTL2CNTL DD *
You'll need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) in order to use DFSORT's IFTHEN and OVERLAY functions. Only DFSORT has these functions, so if you don't have DFSORT, you won't be able to use them. If you do have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the Dec, 2004 PTF, see: