Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Mar 25, 2003 5:32 pm Post subject:
Vallem,
If you have DFSORT R14 PTF UQ90053 (Feb, 2003) installed, you can use the new SPLICE operator of DFSORT's ICETOOL to do this and other kinds of joins. Below is the DFSORT/ICETOOL job to do what you described.
For complete information on DFSORT's new SPLICE operator, including explanations and examples of the base/overlay technique I've used here, see:
If you have DFSORT, but do not have PTF UQ90053 installed, ask your System Programmer to install it (it's free).
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//F1 DD DSN=... input File1
//F2 DD DSN=... input File2
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//T2 DD DSN=&&T2,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CONCT DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,PASS)
// DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//OUT DD DSN=... output file
//TOOLIN DD *
* Reformat File2 records for splicing and add 'B' (base) id
COPY FROM(F2) TO(T2) USING(CTL2)
* Add 'V' (overlay) id to File1 records
COPY FROM(F1) TO(T1) USING(CTL1)
* Splice matching T2 (base) and T1 (overlay) records together to
* interleave fields.
SPLICE FROM(CONCT) TO(OUT) ON(2,7,CH) WITHALL -
WITH(1,1) WITH(9,12) WITH(33,529) USING(CTL3)
/*
//CTL2CNTL DD *
* Reformat File2 records and add 'B' id
OUTREC FIELDS=(2:1,7,21:8,12,562:C'B')
/*
//CTL1CNTL DD *
* Add 'V' id to File1 records
OUTREC FIELDS=(1,561,C'V')
/*
//CTL3CNTL DD *
* Delete spliced records with 'V' id since they represent
* records in File2 without a match in File1.
* Remove the id.
OUTFIL FNAMES=OUT,OMIT=(562,1,CH,EQ,C'V'),
OUTREC=(1,561)
/*
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Mar 25, 2003 6:41 pm Post subject:
Vallem,
Since you have DFSORT, ask your System Programmers to install DFSORT PTF UQ90053 (Feb, 2003) so you can use DFSORT's new SPLICE operator and the other new features available with this PTF as described at:
Tell them you need the PTF installed to improve your productivity. 8) _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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