Here's a common and age-old problem. In fact, I seem to type these few lines a lot of times here. I've been doing this since ... well, a long time.
This works on any two lists that are ordered on the same key, such as master file and updates or two purchased lists of e-mail addresses for spamming or whatever. I've used it with files, result sets, arrays, etc.
This doesn't show complete "end of file" logic. One trick is at end of one file set its key impossibly high. Then the comparisons will work out to process the rest of the other file. Another is to modify the tests to say "If B.eof or A.Key < B.Key ..."
We try not to give complete answers some times, but let you figure most of it out yourself. Let me know if that's enough detail, or going the right direction at all.
![](https://coderanch.com/images/smilies/3b63d1616c5dfcf29f8a7a031aaa7cad.gif)