open input infile1.
open output outfile.
perform read-infile-1 thru read-infile-1-exit until eof1 = 'y'
close infile1 outfile.
read infile1 at end move 'y'y to eof1.
open input infile2.
move 'n' to eof2.
perform read-infile-2 thru read-infile-2-exit until eof2 = 'y'.
read infile2 at end move 'y' to eof2.
if (val1 = val2)
move val1 to val3
move 'y' to eof2.
i didn't mentioned working-storage section,declarations should be according to the usage.