I have 2 files old and an new file of LRECL=80, I have to compare these two files and create 2 output files where one file will have all the changes and the other file will have records that didn't changed.
FILES ARE SORTED BY 2 KEYS - FIELD1 - (POSITION 1 TO 26) & FIELD2 - (POSITION 30 TO 39)
OLD FILE:-
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
AAAAAAAAAAAAAAAAAAAAAAA100 1000000000 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBB100 1000000000 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCC100 2000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
CCCCCCCCCCCCCCCCCCCCCCC200 3000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
FFFFFFFFFFFFFFFFFFFFFFF100 1000000000 111111111111111111111111111111
GGGGGGGGGGGGGGGGGGGGGGG200 1000000000 111111111111111111111111111111
******************************** Bottom of Data ********************************
NEW FILE:-
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
AAAAAAAAAAAAAAAAAAAAAAA100 1000000000 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBB100 3000000000 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCC100 1000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
CCCCCCCCCCCCCCCCCCCCCCC200 4000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDD100 1000000000 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEE100 1000000000 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFF100 1000000000 222222222222222222222222222222
GGGGGGGGGGGGGGGGGGGGGGG200 1000000000 222222222222222222222222222222
******************************** Bottom of Data ********************************
Output:-
WE NEED 2 FILES, ONE FILE WITH ALL THE CHANGES AND OTHER FILE WITH UNCHANGED RECORDS
AFTER COMPARING THE PREVIOUS AND CURRENT FILES, POSTION 28 - INDICATES IF THE RECORD WAS:-
'A' - ADDED - IF THE NEW KEYS (KEYS ARE FIELD1 & FIELD2) HAS BEEN ADDED
'D' - DELETED - IF THE KEYS (KEYS ARE FIELD1 & FIELD2) HAVE BEEN DELETED
'C' - CHANGED - GET THE NEW RECORD FROM THE NEW FILE IF WE FIND CHANGES BETWEEN '41 THRU 80 COLUMNS'
FINALLY THIS FILE WILL BE SORTED BY FIELD1 AND FIELD2
FILE WITH CHANGES:-
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
BBBBBBBBBBBBBBBBBBBBBBB100 D 1000000000 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
BBBBBBBBBBBBBBBBBBBBBBB100 A 3000000000 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCC100 A 1000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
CCCCCCCCCCCCCCCCCCCCCCC100 D 2000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
CCCCCCCCCCCCCCCCCCCCCCC200 D 3000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
CCCCCCCCCCCCCCCCCCCCCCC200 A 4000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDD100 A 1000000000 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEE100 A 1000000000 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFF100 C 1000000000 222222222222222222222222222222
GGGGGGGGGGGGGGGGGGGGGGG200 C 1000000000 222222222222222222222222222222
******************************** Bottom of Data ********************************
FILE WITHOUT CHANGES:-
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
AAAAAAAAAAAAAAAAAAAAAAA100 1000000000 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
******************************** Bottom of Data ********************************
OLD FILE:-
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
AAAAAAAAAAAAAAAAAAAAAAA100 1000000000 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBB100 1000000000 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCC100 2000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
CCCCCCCCCCCCCCCCCCCCCCC200 3000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
FFFFFFFFFFFFFFFFFFFFFFF100 1000000000 111111111111111111111111111111
GGGGGGGGGGGGGGGGGGGGGGG200 1000000000 111111111111111111111111111111
******************************** Bottom of Data ********************************
NEW FILE:-
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
AAAAAAAAAAAAAAAAAAAAAAA100 1000000000 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBB100 3000000000 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCC100 1000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
CCCCCCCCCCCCCCCCCCCCCCC200 4000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDD100 1000000000 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEE100 1000000000 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFF100 1000000000 222222222222222222222222222222
GGGGGGGGGGGGGGGGGGGGGGG200 1000000000 222222222222222222222222222222
******************************** Bottom of Data ********************************
Output:-
WE NEED 2 FILES, ONE FILE WITH ALL THE CHANGES AND OTHER FILE WITH UNCHANGED RECORDS
AFTER COMPARING THE PREVIOUS AND CURRENT FILES, POSTION 28 - INDICATES IF THE RECORD WAS:-
'A' - ADDED - IF THE NEW KEYS (KEYS ARE FIELD1 & FIELD2) HAS BEEN ADDED
'D' - DELETED - IF THE KEYS (KEYS ARE FIELD1 & FIELD2) HAVE BEEN DELETED
'C' - CHANGED - GET THE NEW RECORD FROM THE NEW FILE IF WE FIND CHANGES BETWEEN '41 THRU 80 COLUMNS'
FINALLY THIS FILE WILL BE SORTED BY FIELD1 AND FIELD2
FILE WITH CHANGES:-
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
BBBBBBBBBBBBBBBBBBBBBBB100 D 1000000000 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
BBBBBBBBBBBBBBBBBBBBBBB100 A 3000000000 CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCCCCC100 A 1000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
CCCCCCCCCCCCCCCCCCCCCCC100 D 2000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
CCCCCCCCCCCCCCCCCCCCCCC200 D 3000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
CCCCCCCCCCCCCCCCCCCCCCC200 A 4000000000 DDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
DDDDDDDDDDDDDDDDDDDDDDD100 A 1000000000 EEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
EEEEEEEEEEEEEEEEEEEEEEE100 A 1000000000 FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFF100 C 1000000000 222222222222222222222222222222
GGGGGGGGGGGGGGGGGGGGGGG200 C 1000000000 222222222222222222222222222222
******************************** Bottom of Data ********************************
FILE WITHOUT CHANGES:-
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
AAAAAAAAAAAAAAAAAAAAAAA100 1000000000 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
******************************** Bottom of Data ********************************
Kindly appreciate your help
Thanks for your help in advance,
Lal