IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Comparison of 2 files using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ramya Ganesan

New User


Joined: 24 Sep 2013
Posts: 5
Location: India

PostPosted: Fri Oct 04, 2013 11:41 am
Reply with quote

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
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri Oct 04, 2013 12:29 pm
Reply with quote

Hi Ramya,

If there are no key fields so do you want to compare the whole record?
Back to top
View user's profile Send private message
Ramya Ganesan

New User


Joined: 24 Sep 2013
Posts: 5
Location: India

PostPosted: Fri Oct 04, 2013 12:39 pm
Reply with quote

Hi,

Yeah, I need the whole record to be comapred.
Back to top
View user's profile Send private message
lakshmikondur

New User


Joined: 05 Jan 2006
Posts: 9
Location: hyderabad

PostPosted: Fri Oct 04, 2013 12:48 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Oct 04, 2013 1:44 pm
Reply with quote

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
View user's profile Send private message
Ramya Ganesan

New User


Joined: 24 Sep 2013
Posts: 5
Location: India

PostPosted: Fri Oct 04, 2013 2:38 pm
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Oct 04, 2013 3:00 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri Oct 04, 2013 6:15 pm
Reply with quote

Check the smart DFSORT trick "Create files with matching and non-matching records" here

www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000094
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top