View previous topic :: View next topic
|
Author |
Message |
Ramya Ganesan
New User
Joined: 24 Sep 2013 Posts: 5 Location: India
|
|
|
|
Hi,
My requirement is to compare two input files of same length(65 bytes). I need to compare the files using DFSORT and generate two output files with the length similar to that of input files length.
Desired output is:
One file should contain the matched rows and the other with the unmatched rows. Please help. It is urgent.
P.S: There are no key fields. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Hi Ramya,
If there are no key fields so do you want to compare the whole record? |
|
Back to top |
|
|
Ramya Ganesan
New User
Joined: 24 Sep 2013 Posts: 5 Location: India
|
|
|
|
Hi,
Yeah, I need the whole record to be comapred. |
|
Back to top |
|
|
lakshmikondur
New User
Joined: 05 Jan 2006 Posts: 9 Location: hyderabad
|
|
|
|
This can be achieved by using Join keys in sort
Control card For matching records.
Code: |
JOINKEYS FILE=F1,FIELDS=(1,65,A)
JOINKEYS FILE=F2,FIELDS=(1,65,A)
REFORMAT FIELDS=(F1:1,65)
SORT FIELDS=COPY |
Control card For non-matching records.
Code: |
JOIN UNPAIRED, F1, ONLY
JOINKEYS FILE=F1,FIELDS=(1,65,A)
JOINKEYS FILE=F2,FIELDS=(1,65,A)
REFORMAT FIELDS=(F1:1,65)
SORT FIELDS=COPY |
Code'd |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
It can be done in one step, of course.
Ramya Ganesan,
Sorry, but you are getting paid, we are not. Urgent for you therefore means nothing to us.
We are not trying to be cruel by this, it is just we answer when time allows.
There are lots of examples here of what you want. You need to be clear about what unmatched records you want. If you put unmatched from both files on the same output, you won't know where they have come from. |
|
Back to top |
|
|
Ramya Ganesan
New User
Joined: 24 Sep 2013 Posts: 5 Location: India
|
|
|
|
Hi Lakshmi,
Thank you for piece of code.The matching records are giving me duplicates(it is repeating every record twice).
Hi Bill,
I just need matched records in one file and unmatched in the other without duplicates. Does not really matter which file they come from. Pls let me know if I am not clear. Single step would be great. |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Code: |
JOIN UNPAIRED,F1,F2
JOINKEYS FILE=F1,FIELDS=(1,65,A)
JOINKEYS FILE=F2,FIELDS=(1,65,A)
REFORMAT FIELDS=(F1:1,65,F2:1,65,?)
SORT FIELDS=COPY
OUTFIL FNAMES=MATCH,INCLUDE=(131,1,CH,EQ,C'B"),BUILD=(1,65)
OUTFIL FNAMES=NOMAT,SAVE |
Untested. I must have a sticker saying "Chump" stuck on me somewhere. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
Back to top |
|
|
|