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 is the difference beetween Arrays and Tables in Cobol? please dont give the answer that arrays in cobol terminology is called tables......

3 Answers   BirlaSoft,


what is mainframe? what is the mainframe software ? what is use in s/w field?

7 Answers   CSE,


What is Pic 9v99 Indicates in COBOL?

0 Answers   SwanSoft Technologies,


What should be the sorting order for SEARCH ALL?

5 Answers  


Extract only those records from a PS file which are having word 'TEXT' in the records using COBOL? The word TEXT is not present in a particular position in all the records.

2 Answers   RBS,






How many types of sorts are there in cobol?

5 Answers   Cap Gemini,


What is length is cobol?

0 Answers  


can i give 9(10) in comp 3 instead of s9(10) ? if i can give wht would be ths ans

2 Answers   DELL,


What is the difference between a DYNAMIC and STATIC call in COBOL?

2 Answers  


How do you set a return code to the JCL from a COBOL program?

4 Answers  


What is CALL statement in COBOL?

4 Answers  


in a indexed file what is procedure for read the records from 12 to 18. please give the code example

2 Answers   L&T,


Categories