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

I have 2 dimensional array with having 100 elements. So how to find the 11th item in an array?

6 Answers   IBM,


What are the different data types in cobol?

0 Answers  


How do you submit JCL via a Cobol program?

5 Answers   IBM,


When the working storage variables get allocated? a.At Compile time b.At starting of the run time c.At end of the run time. d.None of these

6 Answers   Wipro,


How to delete the records of a dataset through cobol programme?We should not use jcl utilitities like IDCAMS.

2 Answers  






What is the difference between a binary search and a sequential search what are the pertinent cobol?

0 Answers  


input:- A 10 20 30 40 B 5 7 10 14 C 8 12 14 16.... output:- A = 100,B=36,C=50. Here spaces are considered between numbers. When we give input as above, the numbers should be added n displayed.So please help me out.

4 Answers  


I want ALL ERROR codes in VSAM

3 Answers   American Express, TCS,


I encountered an error when I move spaces to a numeric field?What should I do to move spaces on that field?help please.

9 Answers  


01 a pic s9(5) value -12345, if we disply a , the sign will overpunched with last digit but i need to get the miuns sign in the result?

7 Answers  


Is it possible that the redefines clause has different picture clauses compared to the one it redefined?

0 Answers  


how do u link sub pgm to main pgm ?

2 Answers   TCS,


Categories