|
|
| Author |
Message |
Chirag Dhull
New User
Joined: 29 Aug 2008 Posts: 8 Location: Bangalore
|
|
|
|
Hi !!
I have a Comparex Job which Compares PREVTERM Vs CURRTERM shows O/p like this :-
PREVTERM :
333444555 KRYG M E MARK E KRYG V1
CURRTERM :
333444555 KRYG M E MARK E KRYG V1
333444555 KRYG M E MARYLN F KRYG V6
333444555 KRYG M E MARK E KRYG V1
333444555 KRYG M E ELIGIBLE CHILDREN V8
Comparex OUTPUT :-
333444555 KRYG M E MARYLN F KRYG V6
333444555 KRYG M E MARK E KRYG V1
333444555 KRYG M E ELIGIBLE CHILDREN V8
can You tell me how to get the same O/P using DFSORT |
|
| Back to top |
|
 |
References
|
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 356 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.
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//PREV DD DSN=Your prev file,
// DISP=SHR
//CURR DD DSN=Your curr file,
// DISP=SHR
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
SORT FROM(PREV) USING(CTL1)
SORT FROM(CURR) USING(CTL1)
SELECT FROM(T1) TO(OUT) ON(1,88,CH) NODUPS USING(CTL2)
//CTL1CNTL DD *
SORT FIELDS=(1,80,CH,A)
OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,80))
//CTL2CNTL DD *
OUTFIL FNAMES=OUT,BUILD=(1,80)
/*
|
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
|
so the final output is
|
|
| Back to top |
|
 |
Chirag Dhull
New User
Joined: 29 Aug 2008 Posts: 8 Location: Bangalore
|
|
|
|
Hi ,
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 . |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 356 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)
/*
|
Hope this helps...
Cheers |
|
| Back to top |
|
 |
Chirag Dhull
New User
Joined: 29 Aug 2008 Posts: 8 Location: Bangalore
|
|
|
|
Let me try to explain it in detail :
I have file1 as:
key1
key1
Key2
key3
key3
key3
key5
and File2 as
key1
key1
key1
key2
key3
key3
key4
and the outut shd have :
key1
key4
which means from file2 whatever is not found in file 1 should be there in the output.
Like in case above we dont have key4 in file 1 and also we have one more ocuurence of key 1 in file1. So the output contains both of them... |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 356 Location: San Jose
|
|
|
|
Chirag Dhull,
The following DFSORT/ICETOOL JCL will give you the desired results
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//PREV DD *
KEY1
KEY1
KEY2
KEY3
KEY3
KEY3
KEY5
//CURR DD *
KEY1
KEY1
KEY1
KEY2
KEY3
KEY3
KEY4
//T1 DD DSN=&&T1,DISP=(MOD,PASS),SPACE=(CYL,(X,Y),RLSE)
//OUT DD SYSOUT=*
//TOOLIN DD *
SORT FROM(PREV) USING(CTL1)
SORT FROM(CURR) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,9,CH) ON(81,8,CH) NODUPS USING(CTL3)
//CTL1CNTL DD *
SORT FIELDS=(1,9,CH,A)
OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,80),C'1')
//CTL2CNTL DD *
SORT FIELDS=(1,9,CH,A)
OUTFIL FNAMES=T1,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,80),C'2')
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,OMIT=(89,1,CH,EQ,C'1'),BUILD=(1,80)
/*
|
Hope this helps...
Cheers |
|
| Back to top |
|
 |
Chirag Dhull
New User
Joined: 29 Aug 2008 Posts: 8 Location: Bangalore
|
|
|
|
Thanks Kolusu for the reply...
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.
Please suggest on how to achieve this. |
|
| Back to top |
|
 |
Skolusu
DFSORT Developer
Joined: 07 Dec 2007 Posts: 356 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
| Code: |
//STEP0100 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//PREV DD *
KEY1
KEY1
KEY2
KEY3
KEY3
KEY3
KEY5
//CURR DD *
KEY1
KEY1
KEY1
KEY2
KEY3
KEY3
KEY4
//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(CTL2)
SELECT FROM(T1) TO(OUT) ON(1,9,CH) ON(100,8,CH) NODUPS USING(CTL3)
//CTL1CNTL DD *
SORT FIELDS=(1,9,CH,A)
OUTFIL FNAMES=T1,OVERLAY=(81:1,9,40,10,
SEQNUM,8,ZD,RESTART=(81,19),C'1')
//CTL2CNTL DD *
SORT FIELDS=(1,9,CH,A)
OUTFIL FNAMES=T1,OVERLAY=(81:1,9,40,10,
SEQNUM,8,ZD,RESTART=(81,19),C'2')
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,OMIT=(108,1,CH,EQ,C'1'),BUILD=(1,80)
/*
|
Hope this helps...
Cheers |
|
| Back to top |
|
 |
|
|
|