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 / vivek c
A simple way to take the matching records if there are no duplicates in both the files.
1. Merge both the files and take the duplicates in separate file using XSUM.
//S010 EXEC PGM=SORT
//SORTIN DD DSN=DSN1
// DD DSN=DSN2
//SORTOUT DD DSN=DSNOUT
//XSUM DD DSN=DSN.MATCH
//SYSIN DD *
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=NONE,XSUM
The output DSN.MATCH will have the matched records.
Is This Answer Correct ? | 7 Yes | 0 No |
Post New Answer View All Answers
What is the difference between a binary search and a sequential search what are the pertinent cobol?
How do we get current date from system with century in COBOL?
what is amode(24), amode(31), rmode(24) and rmode(any)?
What is rmode(24)
Why did you choose to work with ibm mainframe cobol programming?
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?
Write a cobol program making use of the redefine clause.
INREC AND OUTREC? HOW TO SPLIT 5K RECORDS TO DIFFERENT FILES IN A FILE IN COBOL? RESTART IN COBOL-DB2? ISOLATION LEVELS?
What is the difference between goback, stop run and exit program in cobol?
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
How are the next sentence and continue different from each other?
what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.
What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?
For rewrite, why is it mandatory that file needs to be opened?
Define cobol?