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

What is the difference between perform … with test after and perform … with test before?

877


how do you reference the esds vsam file formats from cobol programs

627


How do you get the data to code the BMS macro?

1472


if we display var1 then what will b displayed in below condition. 77 var1 pic s9(2) value -10. 77 var1 pic s9(2) value -11. " " " -12. " " " -13. -14 ... ... -19.

5673


Difference between array and sub-script ?

1159






Give some examples of command terminators?

751


what happens if parmparameter passes zero bytes to the program

1659


What is a scope terminator give example?

652


What are the rules of the move verb?

701


What are the cobol coding sheets?

657


How to know whether the module is dynamical or statistical?

650


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?

2093


What are the various section in data division and briefly explain them.

692


Can we change the password using ALTER? anyone tried and changed?

1542


how do you reference the ksds vsam file formats from cobol programs

660