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
How do u write test cases?
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.
How to traceback if I am getting SOC7 or SOC4 abend? List down the steps
What is a SSRANGE and NOSSRANGE?
How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?
How many sections are there in data division in COBOL?
What is a report item?
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?
how do you reference the variable block file formats from cobol programs
What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?
Write a cobol program making use of the redefine clause.
Which division and paragraphs are mandatory for a COBOL program?
How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?
How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?