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 can we find that module can be called – whether DYNAMICALLY or STATICALLY?

954


There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.

1151


How to traceback if I am getting SOC7 or SOC4 abend? List down the steps

5064


Why occurs cannot be used in 01 level in COBOL?

896


What are the different open modes available in cobol?

924






how to access the file from prodution from changeman tool and to submit a file to production

7043


Mention the guidelines to write a structured cobol program?

801


Can we redefine the field of x(200) to less than 200?

1078


input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?

2081


Write a program to enter and display the names of students in a class using the occurs clause.

903


What is the difference between next sentence and continue in cobol programing language?

937


If you are current on the owner of a set, what is the difference between obtain next and obtain first?

827


How can you get the ksds file records into your cobol program?

826


Are you comfortable in cobol or jcl?

792


Name some of the examples of COBOl 11?

2873