View previous topic :: View next topic
|
Author |
Message |
suzeet
New User
Joined: 16 May 2005 Posts: 54
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
why not search Yourself the forum
there are gazillions of examples/snippets that do just that. |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
Search the forum on JOINKEYS |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
suzeet
New User
Joined: 16 May 2005 Posts: 54
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
suzeet
New User
Joined: 16 May 2005 Posts: 54
|
|
|
|
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 |
|
|
suzeet
New User
Joined: 16 May 2005 Posts: 54
|
|
|
|
And yes, most of the times the file will not match. No need to move it into COBOL forum |
|
Back to top |
|
|
|