Roberto R. wrote on 04/25/2006 05:56:22 AM: > Hello, is it possible to do the following with DFSORT/ICETOOL: > > Input1: > A1 X1 > A1 X2 > B1 X1 > B1 Y1 > > Input2: > X1 ABC > X2 DEF > Y1 GHI > > Expected output: > A1 X1 ABC > A1 X2 DEF > B1 X1 ABC > B1 Y1 GHI > > I believe it will require multiple scans of Input2. Hope it is clear enough. > Thanks.
You can use a DFSORT/ICETOOL job like the following. I assumed your input files have RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes. //S1 EXEC PGM=ICETOOL //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //IN2 DD DSN=... input file2 //T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS) //CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS) // DD DSN=... input file1 //OUT DD DSN=... output file //TOOLIN DD * COPY FROM(IN2) TO(T1) USING(CTL1) SPLICE FROM(CON) TO(OUT) ON(5,2,CH) WITHALL WITH(1,2) /* //CTL1CNTL DD * OUTREC FIELDS=(5:1,7,80:X) /* OUT will have: A1 X1 ABC B1 X1 ABC A1 X2 DEF B1 Y1 GHI If you want the output sorted by field1 instead of by field2, you'll need an additional SORT as follows: //S2 EXEC PGM=ICETOOL //TOOLMSG DD SYSOUT=* //DFSMSG DD SYSOUT=* //IN2 DD DSN=... input file2 //T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS) //CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS) // DD DSN=... input file1 //T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS) //OUT DD DSN=... output file //TOOLIN DD * COPY FROM(IN2) TO(T1) USING(CTL1) SPLICE FROM(CON) TO(T2) ON(5,2,CH) WITHALL WITH(1,2) SORT FROM(T2) TO(OUT) USING(CTL2) /* //CTL1CNTL DD * OUTREC FIELDS=(5:1,7,80:X) /* //CTL2CNTL DD * OPTION EQUALS SORT FIELDS=(1,2,CH,A) /* OUT will have: A1 X1 ABC A1 X2 DEF B1 X1 ABC B1 Y1 GHI Frank Yaeger - DFSORT Team (IBM) Specialties: PARSE, JFY, SQZ, ICETOOL, IFTHEN, OVERLAY, Symbols, Migration => DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/ ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html