|
|
| Author |
Message |
ovreddy
Active User
Joined: 06 Dec 2004 Posts: 200 Location: Keane India Ltd., Hyderabad
|
|
|
|
Hi,
I have two files with the following structure. I want to compare the fields from both the files and list the differences if any. The records are sorted in ascending order of a key in both the files.
FILE1: Structure
MBNISS S9(9) (Key sorted by ascending order)
NAME X(20)
AGE 9(2)
ADDRESS1 X(40)
ADDRESS2 X(40)
CITY X(30)
STATE X(20)
FILE2: Structure
MBNISS S9(9) (Key sorted by ascending order)
CREATEDT X(10)
NAME X(20)
AGE 9(2)
ADDRESS1 X(40)
ADDRESS2 X(40) OCCURS 6 TIMES
CITY X(30)
ZIPCODE 9(5)
STATE X(20)
Please give me the code using any utility(DFSORT or ICETOOL) to compare both the files and list the differences.
Thanks,
Reddy. |
|
| Back to top |
|
 |
References
|
|
 |
prabs2006 Warnings : 1 Active User
Joined: 12 Jan 2006 Posts: 104
|
|
|
|
Hi Reddy,
Juz try this...but am not sure...
Give both files as input...and
using ICETOOL, Select from(IN) to(OUT) OCCURS(1,9,zd) list(NODUPS)
above one will display all the recs that are mismatches..check with syntax also... |
|
| Back to top |
|
 |
Alain Benveniste
Active User
Joined: 14 Feb 2005 Posts: 90
|
|
|
|
The structure of your files are different: we can't compare the entire records. So what fields need to be compared ?
Alain |
|
| Back to top |
|
 |
Rupesh.Kothari
Member of the Month
Joined: 27 Apr 2005 Posts: 486
|
|
|
|
Hi,
I also agree with Alain , As teh structure of files are different, we can not compare the whole recorde.
Regards'
Rupesh |
|
| Back to top |
|
 |
ovreddy
Active User
Joined: 06 Dec 2004 Posts: 200 Location: Keane India Ltd., Hyderabad
|
|
|
|
Hi Rupesh/Alain,
Give me a complete JCL to compare the following fields in both the files.
MBNISS S9(9) (Key sorted by ascending order)
NAME X(20)
ADDRESS1 X(40)
ADDRESS2 X(40)
CITY X(30)
STATE X(20)
Thanks,
Reddy. |
|
| Back to top |
|
 |
fixdoubts
Active User
Joined: 21 Oct 2005 Posts: 52
|
|
|
|
Hi,
This might help you
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//*ILEIN1 DD DSN=XT2.SMS.TEST.SORT2,DISP=SHR
//FILEIN1 DD *
245 20 A 230 D 230 E 240
246 20 A 230 D 240 E 240
247 40 B 230 D 230 E 240
//*ILEIN2 DD DSN=XT2.SMS.TEST.SORT3,DISP=SHR
//FILEIN2 DD *
246 30 230 D 230 E 240
247 40 230 D 230 E 240
248 50 230 D 230 E 240
//OUT DD SYSOUT=*
//T1 DD DSN=&&TT,DISP=MOD
//TOOLIN DD *
COPY FROM(FILEIN1) TO(T1) USING(CPY1)
COPY FROM(FILEIN2) TO(T1) USING(CPY2)
SPLICE FROM(T1) TO(OUT) ON(1,14,CH)-
WITHEACH KEEPNODUPS WITH(15,02) USING(CPY3)
/*
//CPY1CNTL DD *
OUTREC FIELDS=(1:1,4,5:10,3,8:16,3,11:22,3,18:5,2,80:X)
/*
//CPY2CNTL DD *
OUTREC FIELDS=(1:1,4,5:8,3,8:14,3,11:20,3,18:5,2,80:X)
/*
//CPY3CNTL DD *
OUTFIL FNAMES=OUT,OUTREC=(1,80)
/*
//
the output is
245 230230240 A
246 230230240 30
246 230240240 A
247 230230240
248 230230240 50
where in 247 is only common and
246 230230240 30
248 230230240 50 are unique in second file and 246 230230240 30 is having different key.
245 230230240 A
246 230240240 A --- different key( 246 230230240in first file ) which is the difference in the key fields
Regards, |
|
| Back to top |
|
 |
|
|
|