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 / soumya santosini patnaik

first load the files in shorted order after that code a
matching program. in the procedure division check the file1
entry with file2 entry if file1 entry = file2 entry then
then write to o/p file end-evaluate esle check for file1<
file2 (if yes then the pointer is brought down to the 2nd
rec of file1 and checked with 1st rec of file2 when the
para is performed for 2nd time),if the above condition is
false then it checks if file1>file2 if yes then pointer is
brought down to the next entry of file2 and checked with
1st entry of file1 with 2nd entry of file2 in next perform
and the process is done till the end of records.

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

example for sub strings ? and refernce modifications whit output pls

1827


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

904


Differentiate cobol and cobol-ii. (Most of our programs are written in cobolii, so, it is good to know, how, this is different from cobol)?

614


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

722


What is redefines clause in COBOL?

832






What is comp-1 and comp-2?

748


Why is it necessary that file needs to be opened in I-O mode for REWRITE?

728


2 input fles: 2 flat files, with different number of records. both are having unique key for each record and already sorted in ascending order . match these files using unique key and in output only matching key value has to be written. please procide cobol logic

2079


Name some of the examples of COBOl 11?

2667


if we have " ibm mainframe ",in that how to remove first and last leading space eg:"ibm mainframe" like that the answer we need

844


What is amode(24)?

671


How to use the same COBOL program in Batch and CICS on lines? explain with an example

1902


Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?

801


What guidelines should be followed to write a structured cobol prgm?

653


What type of SDLC u followed? Why?

1507