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...

Suppose, file A has 100 records and file B has 500 records. We
want to write records common to both A and B into file C and
records which are present only in either A or B into another file D.
What should be the logic of Cobol program to achieve this?

Answer Posted / karan

If we do not want to go with cobol then it can be easily
done with SORT, ICETOOL( Splice option) which i feel is
faster and simpler instead of writing a compare program.
If there is a compultion to use a cobol pgm then soln will
be -
PERFORM untill (EOF A and EOF B)
if f1 = f2
move file1-rec to file3-rec. write file3-rec
read f1 & f2.
if f1 < f2
move file1-rec to file4-rec. write file4-rec.
read f1.
if f1 > f2
move file2-rec to file4-rec. write file4-rec
read f2.
END PERFORM

IF EOF A and not EOF B
PERFORM until EOF B
move move file2-rec to file4-rec.
write file4-rec
read f2.
END PERFORM
ElSE
IF EOF B and not EOF A
PERFORM until EOF A
move move file1-rec to file4-rec.
write file4-rec
read f1.
END PERFORM
END

note: files should be in sorted order ASC before program
runs.
This is a generic solution to al such compare programs.

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

1125


how do you reference the rrds file formats from cobol programs

1656


Write a cobol program making use of the redefine clause.

1228


How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?

1264


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

1482


Write down the divisions of cobol program?

1335


how do you reference the ksds vsam file formats from cobol programs

1245


System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..

2135


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

1310


For rewrite, why is it mandatory that file needs to be opened?

1151


i want to learn mainframe..any websites and material to learn from basic..? my mail id : rajeswaribe2010@gmail.com

2276


how do you reference the esds vsam file formats from cobol programs

1269


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

2606


What are the cobol coding sheets?

1358


How do u write test cases?

2111