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

Name the divisions, which are available in a cobol program?

681


Which division and paragraphs are mandatory for a COBOL program?

707


What is the difference between goback, stop run and exit program in cobol?

920


What is the utilization of copybook in cobol? Could we utilize a similar copybook?

711


Are you comfortable in cobol or jcl?

639






What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?

709


What are different data types in cobol?

685


how to refer the data field?

1802


What is perform what is varying?

701


example for sub strings ? and refernce modifications whit output pls

1843


In COBOL programming, what is PERFORM? What is VARYING?

668


What is Pic 9v99 Indicates in COBOL?

720


What is link edit in cobol?

748


how do you reference the variable unblock file formats from cobol programs

743


Explain the configuration section of a cobol program with examples of syntax.

655