Posted: Wed Aug 20, 2003 6:38 pm Post subject: File Comparing using Sort
Hi,
I'm having two files(File-1 and File-2).I want to compare these two files and extract all the unmatched records from the File-2. For example my inputs and output are as follows.Both are having the key filed at 1,3.
File-1 doesn't have any duplicates whereas File-2 has duplicates.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Aug 20, 2003 7:45 pm Post subject:
Somu,
If you have DFSORT R14 PTF UQ90053 (Feb, 2003), you can use the new SPLICE operator of DFSORT's ICETOOL to do this. For complete information on SPLICE, see:
I assumed your input data sets had RECFM=FB and LRECL=80, but the job can be adjusted for other attributes.
Here's the DfSORT/ICETOOL job:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILE1 DD DSN=... input file1
//FILE2 DD DSN=... input file2
//F2ONLY DD DSN=... output file
//T1 DD DSN=&&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(5,5))
//T2 DD DSN=&&T2,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(5,5))
//T3 DD DSN=&&T3,DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(5,5))
//CONCT DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,DELETE)
// DD DSN=*.T2,VOL=REF=*.T2,DISP=(OLD,DELETE)
// DD DSN=*.T3,VOL=REF=*.T3,DISP=(OLD,DELETE)
//TOOLIN DD *
* Add C'BB' identifier for FILE1 records.
COPY FROM(FILE1) TO(T1) USING(CTL1)
* Add C'XX' identifier for first copy of FILE2 records.
* Add C'VV' identifier for second copy of FILE2 records.
COPY FROM(FILE2) USING(CTL2)
* SPLICE to match up records and write records
* with C'VX' identifier to F2ONLY.
SPLICE FROM(CONCT) TO(F2ONLY) ON(1,3,CH) -
WITHALL WITH(1,81) USING(CTL3)
/*
//CTL1CNTL DD *
* Mark FILE1 records with C'BB'
OUTREC FIELDS=(1,80,81:C'BB')
/*
//CTL2CNTL DD *
* Mark first copy of FILE2 records with C'XX'.
OUTFIL FNAMES=T2,
OUTREC=(1,80,81:C'XX')
* Mark second copy of FILE2 records with C'VV'.
OUTFIL FNAMES=T3,
OUTREC=(1,80,81:C'VV')
/*
//CTL3CNTL DD *
* Write FILE2 only records to F2ONLY file. Remove id.
OUTFIL FNAMES=F2ONLY,
INCLUDE=(81,2,CH,EQ,C'VX'),
OUTREC=(1,80)
/*
_________________ 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
Hi Franks,
Thanks a lot for the solution. But I don't have the required PTF (DFSORT R14 PTF UQ90053 ) installed. I will try to get it done as soon as possible. But would like to know whether we can do it without using the SPLICE operator..
Please advice ..
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Aug 21, 2003 10:24 am Post subject:
Somu,
Given that you have duplicates in File2 that you want to keep, I don't know of any other "practical" way to do this without SPLICE. _________________ 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