Using COBOL the solution is something like this:
As both the files are sorted u need not have to do a sort in asc order. So u may ignore this step.
Perform this para until end of (file1 or file2)
WHEN (file1-ACCNO > FILE2-ACCNO)
read file 2
WHEN (file1-ACCNO < FILE2-ACCNO)
WHEN (file1-ACCNO = FILE2-ACCNO)
write output file