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 you reference the following file formats from cobol programs?

682


what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.

8103


) How do u handle errors in BMS macro

1491


please..could u give an example about USAGE IS POINTER ..and explain why and when we use it ?

1939


how to convert the recors form vsam file to db2 table tru file aid

2740






Why would you use find and get rather than to obtain?

665


i need a small 3d program using inline and outline.

1624


How do you reference the fixed block file formats from cobol programs

686


Write down the divisions of cobol program?

653


how to access the file from prodution from changeman tool and to submit a file to production

6654


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

1826


can you please let me know if there is any walkins for COBOL/PLI/DB2/IMS/JCL in pune other than IBM and ITC infotech

1940


Whats the difference between search & search ALL?

5224


What is the difference between comp and comp-3 usage?

665


How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)

2701