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
input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?
How to remove the spaces at the end of each record in the output file of variable length, via cobol program?
Explain what you understand by passing by value.
How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?
What is the difference between structured cobol programming and object alternativelyiented cobol programming?
What is the difference between next sentence and continue in cobol programing language?
Can you please let me know the centre name of INS certification in Kolkata.
What are 77 levels used for?
What is static and dynamic call in cobol?
Difference between array and sub-script ?
Which mode is used to operate the sequential file?
What is the default value(s) for an initialize? What keyword will allow for an override of the default?
If you are current on the owner of a set, what is the difference between obtain next and obtain first?
What is the difference between Global and External Variables?
What is cobol?