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 mainframe? what is the mainframe software ? what is use in s/w field?

7 Answers   CSE,


Consider the following COBOL entries 05 X PIC 99 VALUE 10. ADD 40 X TO X. COMPUTE X = 3 * X - 40. The result in X is

12 Answers   TCS,


i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?

0 Answers  


hie everyone.i just completed my b.tech in electronics and joined mainframes course.am i doing right course for my better future?please help me with your suggestions.ill be very thankful to you guys.

2 Answers  


give the examples of strings in cobol

1 Answers   IBM,






What is an in line PERFORM? When would you use it? Anything else to say about it?

4 Answers  


how to crack cts interview apps? NOVEMBER 21 2010

2 Answers   CTS,


.How to add one input & one Out file in existing cobol program. how approach tell me step by step.

2 Answers   Syntel,


what r the types of perform statement

4 Answers  


What is 77 level used for ?

12 Answers   IBM, iGate,


what is subscript in cobol?give realtime example?

2 Answers   Wipro,


What is rmode(24)

0 Answers  


Categories