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

Compare two files, Not matched come out of comparision


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

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Tue May 20, 2014 12:31 pm
Reply with quote

Hi,
I have two files F1 and F2 and the files are 80 bytes of length and Fixed block. Both the files contains 5 bytes Employee number starting from 1st position.
My requirement is compare F1 and F2 on employee number and if there is a unmatching record then comeout of comparision and write F1 file. And if both the files matched, then don't write anything.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue May 20, 2014 12:44 pm
Reply with quote

why not search Yourself the forum
there are gazillions of examples/snippets that do just that.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


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

PostPosted: Tue May 20, 2014 1:41 pm
Reply with quote

Search the forum on JOINKEYS
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: Tue May 20, 2014 1:49 pm
Reply with quote

You want to compare two files on a key: if they are different, you want to write out the entire content of F1; if they are the same you don't want to do anything?
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Tue May 20, 2014 2:50 pm
Reply with quote

Yes Bill. I want to compare two files on a key: if they are different, you want to write out the entire content of F1; if they are the same you don't want to do anything.
But here is the twist. I don't want to read all the records of F1. Suppose I have 100 records in F1 and 20 Records in F2. And First record of F1 don't have a matching key in the entire file of F2, then I don't want to process further. Come out of comparison (donot want to compare 2nd record of F1 with F2) and write F1 as it is.
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: Tue May 20, 2014 2:59 pm
Reply with quote

OK. Can't be done with SORT. You'll need a program then. If you say which language you'd like to use, I can move the topic.

Seems a strange requirement, but it is certainly a killer. Is it the case that most of the time the files will not match?

Just as a suggestion for your program, why bother to copy the F1? Why not just set a Return Code, and use the original F1 later as "the copy". Doesn't seem to be much point in a plain copy.
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Tue May 20, 2014 3:08 pm
Reply with quote

Thanks Bill. I was just enquiring is it possible in SORT or not. I will code it thru Cobol. That will be easy for me and will take care of your suggestion. Thanks again
Back to top
View user's profile Send private message
suzeet

New User


Joined: 16 May 2005
Posts: 54

PostPosted: Tue May 20, 2014 3:12 pm
Reply with quote

And yes, most of the times the file will not match. No need to move it into COBOL forum
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
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 Merge two VSAM KSDS files into third ... JCL & VSAM 6
Search our Forums:

Back to Top