Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

how do you reference the printer file formats from cobol programs

1219


How many bytes S(8) comp field occupy and its maximum value?

2140


Difference between array and sub-script ?

1656


What is the utilization of copybook in cobol?

1189


What is the difference between perform … with test after and perform … with test before?

1439


Why occurs cannot be used in 01 level in COBOL?

1158


How you can read the file from bottom?

1156


Write a program to enter and display the names of students in a class using the occurs clause.

1205


how do you reference the variable block file formats from cobol programs

1251


Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc

1249


what is search and searchall?what is the diffrence between them?give an best example?

6822


What is the difference between comp and comp-3?

1183


If you are current on the owner of a set, what is the difference between obtain next and obtain first?

1342


What is the difference between goback, stop run and exit program in cobol?

1588


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

7547