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
What is an in line perform? When would you use it? Anything else you wish to say about it.
1.Is it possible to move the data from 99.99 to 99v99? 2.What is the CICS-vsam Compilation process? 3.In My GDG 5 generation will be there GDG3 got an abend what will happen? 4.In my GDG first generation is +1 And I want to add the new generation what will happen previous generation? 5.How can you give the PIC clause below conditions A). s9 (reddy), B). s9 (5) occurs 5 times? 6.How override the proc from a particular step? and what is symbolic and override Procs?
What is the difference between PIC 9.99 and PIC9v99?
Name some of the examples of COBOl 11?
I need to compare 3 variables(dates) and do some processing based on the earliest date. There could be more then 1 date record in any of the 3 fields. What is the best way to code this?
How to traceback if I am getting SOC7 or SOC4 abend? List down the steps
What is the difference between perform … with test after and perform … with test before?
How do you get the data to code the BMS macro?
What is the difference between external and global variables in COBOL?
How do get the result of your program directly on your pc?
What guidelines should be followed to write a structured cobol prgm?
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?
what happens if parmparameter passes zero bytes to the program
Give some examples of command terminators?
How to use the same COBOL program in Batch and CICS on lines? explain with an example