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)
00223JA Williams
01234BB Johnson
04343AB Obama
45989General Johnson
File B (unload target table)
01234BB Johnson
04343AB Obamaaaaaaaa
12129John McBain
45989General Johnson
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)
12129John McBain
File 2 (inserts)
00223JA Williams
File 3 (updates)
04343AB Obama
File 4 (unchanged)
01234BB Johnson
45989General Johnson
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
File
I00223JA Williams
N01234BB Johnson
U04343AB Obama
D12129John McBain
N45989General Johnson
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
revdpoel,
The following DFSORT/ICETOOL will give you the desired results. You can do this with the new WHEN=GROUP function of DFSORT available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008) like this:
To differentiate the 2 files from each we add a dummy record before each file which has a string HEADER and we use that to propagate it to every record in the file that follows it
do you also know a solution for the second question?
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
File
I00223JA Williams
N01234BB Johnson
U04343AB Obama
D12129John McBain
N45989General Johnson
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
revdpoel,
oops did not see that you asked for 2 solutions.For the second requirement, use the following DFSORT/ICETOOL job. The output lrecl is increased by a byte to accomadate the indicator in pos 1