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 / ajay kumar ande

OPEN INPUT FILE1
OPEN INPUT FILE2
OPEN OUTPUT FILE3

MOVE 'N' TO EOF
PERFORM UNTIL EOF='S'
READ FILE1 AT END MOVE 'S' TO EOF
READ FILE2 AT END MOVE 'S' TO EOF

IF EMPNO1 = EMPNO2
MOVE
REC2 TO REC3
WRITE REC3
END-PERFORM.

CLOSE FILE1, FILE2, FILE3.

Is This Answer Correct ?    10 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

) How do u handle errors in BMS macro

1508


What are the pertinent COBOL

2045


Discuss about changing dataset name in proc.

759


Which is not true about evaluate statement

1574


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?

2098






What is a scope terminator give example?

655


what are decleratives in cobol?

1827


What is the default value(s) for an initialize and what keyword allows for an override of the default?

695


Whats the difference between search & search ALL?

5264


How do define dynamic array in cobol. how do you define single dimensional array and multidimensional array in your cobol?

706


What are various search techniques in cobol? Explain.

646


What is Pic 9v99 Indicates in COBOL?

726


Write a cobol program making use of the redefine clause.

731


What is the difference between binary search and sequential search?

638


Explain how you can characterize tables in cobol?

636