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

How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?

737


What are the different rules for performing sort operation?

759


how do you reference the printer file formats from cobol programs

660


Write the code to count the sum of n natural numbers.

697


In which area will you utilize 88 level items in cobol?

721






What is the Purpose of Pointer in the string?

641


How you can characterize tables in cobol?

715


In COBOL, what is the different between index and subscript?

755


What is the local-storage section?

681


IF I mention stop run in CICS what happens?

1895


What are the rules of the move verb?

704


How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?

1934


What is rmode(any) ?

685


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

710


How are the next sentence and continue different from each other?

765