Here i have declared all the fields of input file as key to faclitate the compare without any dups.
The problem i faced was since the inserted/updated record would present
only in current version (i.e) in this case its SORT1. here plese suggest how to code so that inserted and updated records are identified.
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
When you have a new question, you need to start a new topic. This has been split from the original topic.
Suggest you post some sample input data for both files, the output you want when this is processed, and where you are stuck. It seems to me that when there is a match, the current would be the update. If you insist on comparing the entire record, i don't see how you would get what you want. You need to match on the "key" and when they are equal, compare the other fields. . .
For an "insertion", a record will only appear on the current file.
For an "update", a record will appear on both files (with the keys matched).
For a "delete", (if it is possible for your system) a record will only appear on the previous file.
For a "nothing has happened to this today", a record will appear on both files (with the keys matched).
So, once you get the match you have to, as Dick has said, check whether anything has changed.
You do have a potential problem. In this, and your previous Easytrieve on here, you haven't coded for "deletes", you haven't done anything with SORT2 where it might exist on it's own.
Maybe you don't allow deletes, so that is OK? But if you change anything in one of your fields defined as a key, then it will "look" like a delete, ie the matching will find it only on SORT2 and you will miss it completely.