Author: Suganya87
Subject: File comparsion - Records are in different Layout
Posted: Tue May 10, 2016 1:05 pm (GMT 5.5)
Hi,
I need to write a Cobol program which does file comparison between Latest Generation of file & Base Version of file. Record is 100 bytes long.
Each and every record in the file is in different layout. But we have unique record id for each record. I need to find the fields in the record layout whose values have changed in the latest file .
My approach :
01 latest-file
copy customer-rec1
copy customer-rec2
01 base-file
copy customer-rec1
copy customer-rec2
05 customer-rec1
1o employee id pic x(10).
10 employee pic x(10).
10 designation pic x(10).
10 salary pic 9(10).
Procedure :
Evaluate employee-id of latest-file
when '1000'
if employee of latest-file not= employee of base-file
Write "Mismatch found in employee"
end-if
if designation of latest-file not = designation of base-file
Write "Mismatch found in designation"
end-if
if salary of latest-file not= salary of base-file
Write "Mismatch found in salary
end-if
when other
continue
end-evaluate.
Instead of manual comparison of each and every field in copybook. do we have any other approach to do the same.
Thanks in Advance.
Subject: File comparsion - Records are in different Layout
Posted: Tue May 10, 2016 1:05 pm (GMT 5.5)
Hi,
I need to write a Cobol program which does file comparison between Latest Generation of file & Base Version of file. Record is 100 bytes long.
Each and every record in the file is in different layout. But we have unique record id for each record. I need to find the fields in the record layout whose values have changed in the latest file .
My approach :
01 latest-file
copy customer-rec1
copy customer-rec2
01 base-file
copy customer-rec1
copy customer-rec2
05 customer-rec1
1o employee id pic x(10).
10 employee pic x(10).
10 designation pic x(10).
10 salary pic 9(10).
Procedure :
Evaluate employee-id of latest-file
when '1000'
if employee of latest-file not= employee of base-file
Write "Mismatch found in employee"
end-if
if designation of latest-file not = designation of base-file
Write "Mismatch found in designation"
end-if
if salary of latest-file not= salary of base-file
Write "Mismatch found in salary
end-if
when other
continue
end-evaluate.
Instead of manual comparison of each and every field in copybook. do we have any other approach to do the same.
Thanks in Advance.