Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Chirag Dhull,
The following DFSORT/ICETOOL JCL will give you the desired results. I assumed that both your input files are FB recfm and 80 bytes in length. I also assumed that you have duplicates in both files and your comparison key is full 80 bytes. Make sure that you have Disp=MOD for the temp file T1.
Comparex is a any-to-any comparison tool which compares the contents of any two libraries, directories, files, or databases.
In this case the utility is comparing each record from file1 with records in file2. It is a many to many comparision. Based on the sample input and output shown it comes down to one to one comparision.
ex: prev file records
Code:
key1
key1
key2
key3
key3
key3
ex: CURR file records
Code:
key1
key1
key1
key2
key3
We have duplicates in both files but we can make them unique keys by adding a seqnum at the end using RESTART parm of DFSORT
prev file records will be padded like this
Code:
key1 1
key1 2
key2 1
key3 1
key3 2
key3 3
CURR file records will be padded like this
Code:
key1 1
key1 2
key1 3
key2 1
key3 2
Since we are using MOD as disp records from both files are appended and we select all unique keys treating the record plus the seqnum as key
Code:
key1 1 - drop
key1 1 - drop
key1 2 - drop
key1 2 - drop
key1 3 - keep
key2 1 - drop
key2 1 - drop
key3 1 - drop
key3 1 - drop
key3 2 - drop
key3 2 - drop
key3 3 - keep
Actually i tried running this code , but i am not getting the O/p which i need .Is it because only one of my files has duplicate entries and other doesnt ?
My Comparex takes the Prev file and curr file as input with SYSIn :- KEY(1,9) , FIELD (1,9) .COPYDIFF , MLC=40.
CURR file has duplicate entries(Lrecl of files is 50)
PREV file doesnt have (Lrecl of files is 50 )
For e.g ;-
CURR File:-
333444555 KRYG M E 7 LANE RICHMOND STREET XYZ CITY
333444555 KRYG M E 7 LANE RICHMOND STREET XYZ CITY
445556677 BOB R W 9 LANE HARMISON STREET ABC CITY
PREV File;-
333444555 KRYG M E 7 LANE RICHMOND STREET XYZ CITY
445556677 BOB R W 9 LANE HARMISON STREET ABC CITY
O/p :-
333444555 KRYG M E 7 LANE RICHMOND STREET XYZ CITY
This is the O/p which Comparex gives me . Please tell me how to acheive this using some other tool .
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Chirag Dhull,
The job shown above DOES give you the desired results. You just need to modify it according to your key comparison. The job shown above is comparing 80 bytes as key and now you only have 9 bytes to compare. You need to understand the job and modify it accordingly.
Anyway here is a job which will give you the desired results
Code:
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//PREV DD *
333444555 KRYG M E 7 LANE RICHMOND STREET XYZ CITY
445556677 BOB R W 9 LANE HARMISON STREET ABC CITY
//CURR DD *
333444555 KRYG M E 7 LANE RICHMOND STREET XYZ CITY
333444555 KRYG M E 7 LANE RICHMOND STREET XYZ CITY
445556677 BOB R W 9 LANE HARMISON STREET ABC CITY
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(1,1),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
SORT FROM(PREV) USING(CTL1)
SORT FROM(CURR) USING(CTL1)
SELECT FROM(T1) TO(OUT) ON(1,9,CH) ON(81,8,CH) NODUPS USING(CTL2)
//CTL1CNTL DD *
SORT FIELDS=(1,9,CH,A)
OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,80))
//CTL2CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
But , the solution given above works till some extent in my case but its still not giving the desired result.
The problem is that in some of the records few fields gets changed(ie post marriage surname and all ). So overlay doesnt work properly if taken entirely.
I need to have it like restart(1,9) and then restart(40,10) to have the sequence number properly. assuming we have surname in between 10-39 byte.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Chirag Dhull,
*sigh* you need to spell out your requirements properly. I think the following DFSORT/ICETOOL job will give you the desired results based on your description. if it doesn't work then you need to show me an example of your input and desired output with the DCB properties and also explain the rules in detail