I have the next problem.
Two files (which are unloads from a DB2-table) have to be matched. I will simplify the problem to make it more understandable
Both files are FB 80.
Both files contain a customer-id (numeric 5) and a customer-name (char 75). They are sorted on customer-id. There is only one record per customer-id.
File A (unload source table, leading table)
File B (unload target table)
In file A the record from file B with customer-id 12129 is not available. We call this a delete (from the target table).
In file B the record from file A with customer-id 00223 is not available. We call this an insert (into the target table)
Customer-id 04343 is available in both files and the name is changed. We call this an update (in the target table)
Customer-id’s 01234 and 45989 are available in both files and unchanged.
I would like to have two solution.
Solution 1 where 4 files are created: file 1 with the deletes, 2 with the inserts, 3 with the updates and 4 with the unchanged.
File 1 (deletes)
File 2 (inserts)
File 3 (updates)
File 4 (unchanged)
Solution 2 where 1 file is created. In this file the records records get a mutation-indicator in the first position. D = delete, I = insert, U = update, N = Not changed