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?



In file1 have 80 records are like d1,d2,d3......D80. File2 have 1000records are like a1d1,a1d2,a3d3...

Answer / animesh

It can be done using internal array table within the cobol program. first we will Move Record file in an aray with same Lrecl as the file1 and having 80 occurence.
Then again for file 2 we will populate another internal array table with 1000 occurence.

perform varying w-v-idx1 from w-k-1 by w-k-1 until
w-v-idx1> 80

perform varying w-v-idx2 from w-k-1 by w-k-1 until
w-v-idx2>1000

If w-v-file1(w-v-idx1) = w-v-file2(idx2)
Set some w-s-count = y
Add +1 to w-s-count

move -w-v-file1(w-v-idx1) to w-v-file3
write file 3 from w-v-file

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More COBOL Interview Questions

what are the error codes in cobol, db2, cics, vsam , and jcl

2 Answers   TetraSoft,


what is subscript in cobol?give realtime example?

2 Answers   Wipro,


)what is retrieve?

1 Answers   IBM,


What is Comm?

2 Answers   IBM, Kemper Corporation,


9(2).99 how many bytes take? Why . consider as a byte?

2 Answers  


how do u indetify files succesfully executed or not ?

4 Answers   TCS,


How do define Dymanic array in cobol how do u define single demensional arry and multidymensional arry in ur cobol.

4 Answers   Cap Gemini,


Differentiate COBOL and COBOL-II?

0 Answers  


How to remove the spaces at the end of each record in the output file of variable length, via cobol program?

0 Answers  


What is length is cobol?

0 Answers  


How you can delete a record from a ps file in cobol?

1 Answers  


If there are two files one with 100 records and other with 101 records. we have to find out the one record that is the odd man out . What are the steps to do it

7 Answers   BirlaSoft,


Categories