Page 1 of 1

compare vsam file with data from flat file as reference

Posted: Wed Feb 22, 2017 9:32 pm
by Nag849
I want to develop code to compare 2 files (file1 vsam, file2-ref FB)


input:
file1 - F1field1 F1filed2 F1field3 F1field4
aaa 10 x y
bbb 12 o n
file2 - F2field1 F2filed2 F2filed3 F2field4
aaa 10 x b
bbb 12 r n

output file
aaa 10 not matching field4 y
bbb 12 not matching filed3 r

file1 has 100 variables col1 to col
file2 has 10 variables.. lets say filed1 filed2 field3 field4.etc
i want to compare file1 first 2 fields with file2 first 2 fields if matches then compare each field of same record in file1 with reference of file2. i want to write un matched record on the output file. so here the comparision is 1 to many because 1st record in file should be compared with all records in file 2 as its my reference data. if first 2 fields matches but not maching other fields in the record, then i want to write unmatched filed only. not the entire record.

i wrote the logic but getting soc7 when comparing vsam record with other format file. any code for this will be appreciated.


if F1filed1 F1filed match with any records from file2 then compare filed3 and field4 from both files if not matching then write output file F1field1, F1filed2 unmatched filed3