File -1: (key is Item(6bytes) + Location(4bytes). CST field is a dump from a table and has a assumed 4 decimal spaces)
Item Location RTL CST
55037 5001 3198.4 2286.752
283846 5001 166301.52 129381.0672
330143 5001 30054.99 23547
330178 5001 30474.92 23876
55037 5001 3198.4 2286.752
283846 5001 166301.52 129381.0672
330143 5001 30054.99 23547
330178 5001 30474.92 23876
File -2: (key is Item (6bytes)+ Location(4bytes). CST field is a dump from a table and has a assumed 4 decimal spaces)
Item Location RTL CST
55037 5001 3198.4 1286.752
283846 5001 166301.52 119381.06
330143 5001 30054.99 23547
330000 5001 30474.92 23876
55037 5001 3198.4 1286.752
283846 5001 166301.52 119381.06
330143 5001 30054.99 23547
330000 5001 30474.92 23876
Requirement:
1. We need to compare the key fields (item + location) of the two files, file-1 and file-2. for the matching records we need to write an output record which will have the "ITEM", "LOCATION" and a difference of CST field of file-1 and CST field of File-2. (CST-File-1 - CST-File-2).
2. When the record is found on file-1 and not on file-2, we need to write an output record which will have "ITEM", "LOCATION" and a negated value of the CST field of file-1.
3. When the record is found on file-2 and not on file-1, we need to write an output record into a different output file which will have "ITEM", "LOCATION" and "CST" fields as in the file.
Expected OUTPUT:
Output-File-1:
Item Location CST
55037 5001 1000.0000
283846 5001 10000.0072
330143 5001 0.0000
330178 5001 -23876
55037 5001 1000.0000
283846 5001 10000.0072
330143 5001 0.0000
330178 5001 -23876
Output-File-2:
Item Location CST
330000 5001 23876
330000 5001 23876