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.

Answers were Sorted based on User's Feedback



I have dataset DS1 which has records say 1 2 3 4 5 ... ... etc And also I have second ..

Answer / 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

I have dataset DS1 which has records say 1 2 3 4 5 ... ... etc And also I have second ..

Answer / harsha

Use following JCL
//STEP010 EXEC PGM=ICETOOL
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//FILEIN DD DSN=XXXXXXXXXXXXXX,DISP=SHR
//TOOLIN DD *
SELECT FROM(FILEIN) TO(UNIQFL) -
ON(1,73,CH) NODUPS
SELECT FROM(FILEIN) TO(DUPFL) -
ON(1,73,CH) ALLDUPS
/*
//*
//DUPFL DD SYSOUT=*
//UNIQFL DD SYSOUT=*
//*

Label DUPFL will show all duplicate records
Label UNIQFL will show all unique records

Is This Answer Correct ?    1 Yes 1 No

I have dataset DS1 which has records say 1 2 3 4 5 ... ... etc And also I have second ..

Answer / 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

I have dataset DS1 which has records say 1 2 3 4 5 ... ... etc And also I have second ..

Answer / ganesh

Okay Agree with above solution. Now tell me how to do using COBOL Read statement logic.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More COBOL Interview Questions

How many maximum number of procedures can we write in one COBOL program?

6 Answers  


i have 10 names in an array and my name is one of them also array is not in sorted order i need to display my name using index how will i do this

0 Answers  


What are decleratives in COBOL ?

1 Answers   Xansa,


What is the significance of 'above the line' and 'below the line'?

2 Answers   Nokia,


When is a scope terminator mandatory?

3 Answers  


which of the following can be used as a check protection symbol a.Z b.S c.* d.+

2 Answers   TCS,


In file1 have 80 records are like d1,d2,d3......D80. File2 have 1000records are like a1d1,a1d2,a3d3.....Etc. I want matching records in file3 ? Plse tell me the matching logic???I want answer only in cobol ?Not using any tool or jcl?

1 Answers   CSC,


How to remove the spaces at end of each record in the output file Via COBOL program? note: The file has a VB length

3 Answers   TCS,


what is linkcard in cobol?

1 Answers   TCS,


we can use set true for condition names.. similarly can we code set to false in cobol pgm? will it work?

1 Answers  


What does the IS NUMERIC clause establish ?

2 Answers  


i am a btech cs 2009 passout. i am opting for mainframe course. is it good to do this course? pls. anyone suggest me

4 Answers  


Categories