I have the requirement to compare the two files and pick up
the matching records.
File 1. file2

23 32
32 13
34 15
35 36
36 35
43

Get the matching records from this 2 files to out file. how
you will do this in cobol program?

Answer Posted / nnn

First sort the both files through JCL or internal sort.
Then follow below logic in the program.

Read file1
Read file2

perform until end-of file1 OR end-of file2
if file1 = file2
write a matched record to output
read file1
read file2
end-if
if file1 < file2
read file1
end-if
if file1 > file2
read file2
end-if
End-perform.

Is This Answer Correct ?    117 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between comp and comp-3?

689


Why would you use find and get rather than to obtain?

671


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

1894


How can we find that module can be called – whether DYNAMICALLY or STATICALLY?

701


Define static linking and dynamic linking.

652






What are the rules of the move verb?

691


I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

1219


how do you reference the printer file formats from cobol programs

643


How do we get current date from system with century in COBOL?

792


What is the Purpose of Pointer in the string?

632


how can i see junk values in dclgen or in hostvariable of comp ?

2532


If you are current on the owner of a set, what is the difference between an obtain next and obtain first? Actually in which topic will we use dis???Plz explain it clearly

2651


How do define dynamic array in cobol.

659


What is the compute verb? How is it used?

649


What are the pertinent COBOL

2035