I need to compare two files of different lengths and key fields are also in different positions. Please find the details as below:
FILE-1, LRECL=2000 & FB, Key field position - 1 to 20 (X(20)).
Sample data:
Key-Field Field-2 (Pos-145 len-9) Fild-3(pos-511-len-1)
--------- ------------------------ -----------
0000000000000000000003/29/2012 ==> Header with date
11111111111111111111 123456789 C
22222222222222222222 777888999 O
33333333333333333333 666333222
44444444444444444444 111444777 O
55555555555555555555 111555999 C
66666666666666666666 888555222 C
77777777777777777777 111222333 E
88888888888888888888 999666333 E
9999999999999999999900000010 ==> Trailer with record count
FILE-2, LRECL=691 & FB, Key field position - 280 to 299 (X(20)).
Sample data:
The output file will be LRECL=2000 & FB and this needs to created based on below conditions.
1. Header and trailer needs to copied as is, but trailer should be updated with latest count of records.
2. The output file will have all matching and non-matching record but with Field-3 NOT = 'E' and with another below condition.
3. For all matching record, Field-2 should be copied as it is and for all non-matching records Field-2 should be masked (spaced out). Field-2 has sensitive data and we need to mask it for all non-matching records.
The desired output would looks like:
Key-Field Field-2 (Pos-145 len-9) Fild-3(pos-511-len-1)
--------- ------------------------ -----------
0000000000000000000003/29/2012 ==> Header with date
11111111111111111111 123456789 C
22222222222222222222 O
33333333333333333333 666333222
44444444444444444444 O
55555555555555555555 111555999 C
66666666666666666666 C
9999999999999999999900000008 ==> Trailer with record count
I am sorry, if I am having too many condition check here, I am not sure whether we can achieve this using ICETOOL/DFSORT. Please let me know.
I am attaching the document which has screen prints of sample data.