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

subscript and index r not coded in u r application program what will happen?

2 Answers  


what is filler and what is use of filler

3 Answers   Syntel,


What are options have been removed in COBOL 11?

1 Answers  


What is the difference between CONTINUE & NEXT SENTENCE ?

2 Answers  


RENAME clause takes new SPACE in memory.TRUE or FALSE? a)TRUE 2)FALSE

12 Answers   TCS,






There is a variable with value 19446. Requirement is to convert it to 194.46. I tried it by doing divide by 100 and my receiving field data type is 9(03)v99. But the output is 194. I am not getting the decimal value. Could anyone pls let me know how to get this done?

2 Answers  


What is 66 level number and where it is used in real time by software developers?

2 Answers   ITC Indian Tobacco Company, TCS,


In my table having 3000 Records. How can I delete the 500th row? (we don't know what is data inside the table)

3 Answers   Keane India Ltd,


How to use the same cobol program in Batch and CICS onlines ? Please expalin with an example. Thanks in advance.

1 Answers  


i want to store 20 digits . h will u do it in cobol ?

4 Answers   TCS,


I want to declare a field with data type Double in my COBOL program. how shall i do that ?

5 Answers  


what is the difference between implicit and explicit scope terminator with example? 

1 Answers  


Categories