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


Please Help Members By Posting Answers For Below Questions

Define cobol?

838


What type of SDLC u followed? Why?

1495


What are the pertinent COBOL commands?

2603


How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?

1840


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

674






HOw can I get the negative sign while deduct high value from low value

1763


In COBOL programming, what is PERFORM? What is VARYING?

650


What is the difference between structured cobol programming and object alternativelyiented cobol programming?

679


Differentiate between structured cobol programming and object-oriented cobol programming.

644


What is redefines clause in COBOL?

815


What is the difference between next sentence and continue in cobol programing language?

683


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

1518


What happens when we move a comp-3 field to an edited (say z (9). Zz-)?

743


What rules are to be followed while using the corresponding options?

615


How do u write test cases?

1619