I have dataset DS1 which has records say
1
2
3
4
5
...
...
etc
And also I have second dataset DS2 whcih has records
1
3
4
5
6
8
..
...
Both the files are sorted and now I want to compare these files and write it into the third files if the records are matching.
Answer Posted / leo
Using matching logic:
perform following code until either of EOF is found.
EVALUATE TRUE
WHEN KEY1> KEY2
READ FILE2
WHEN KEY2> KEY1
READ FILE1
WHEN KEY1=KEY2
WRITE FILE3 (WHATEVER FORMAT YOU WANT)
READ FILE1
READ FILE 2
END-EVALUATE
You can perform above code until both EOF found, incase you
need to create another file for non matching records. for
matching records only performing until either of EOF will
work.
~LEO
| Is This Answer Correct ? | 1 Yes | 1 No |
Post New Answer View All Answers
Write a program to enter and display the names of students in a class using the occurs clause.
What are the different rules for performing sort operation?
What is the difference between comp and comp-3?
Explain the configuration section of a cobol program with examples of syntax.
What do you understand by psb and acb?
What is a SSRANGE and NOSSRANGE?
What are the different rules to perform a Search?
What are INPUT PROCEDURE and OUTPUT PROCEDURE?
Our issue is there seems to be a disconnect, or no link, between our SELECT statement and our SD. We had SELECT SORT-FILE and SELECT SORT-FILE ASSIGN TO SORTWRK. ASSIGN TO SORTWRK1 SORTWRK2 SORTWRK3 SORTWRK4. with SD SORT_FILE RECORD CONTAINS 7833 CHARACTERS. In either case, at run time, the system ignored our SORTWRK# DD statements and allocated 16 sort works with the SORTWK## naming convention. Any ideas why the system does not recognize the connection? We do not even need the SORTWRK DD statements. Thanks
What are 77 levels used for?
Define cobol?
I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue
Which division and paragraphs are mandatory for a COBOL program?
How do define dynamic array in cobol.
HOw can I get the negative sign while deduct high value from low value