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?

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc

1036


how we sort two input files based on a common column and giving one o/p file please send me the coding logic?

1885


What is the difference between goback, stop run and exit program in cobol?

1228


Why occurs cannot be used in 01 level in COBOL?

912


How do get the result of your program directly on your pc?

2069


can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there

2117


What is the utilization of copybook in cobol? Could we utilize a similar copybook?

949


What is the difference between structured cobol programming and object alternativelyiented cobol?

992


Explain about different table spaces.

859


input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.

1954


If you are current on the owner of a set, what is the difference between obtain next and obtain first?

848


I have a program with an Array of 5000 occurences which is being passed from 5 sub levels to the front end screen. Thess 5 programs using each 5*2 = 10 different arrays with size as 5000. This is causing the transaction to utilize more storage consupmtion. I am looking to reduce the storage consumption. As part of that initially i thought Dynamic array may solve my problem. After viewing the comments given i see its same as normal array. IS there any other way we can resolve this issue?

1410


what is amode(24), amode(31), rmode(24) and rmode(any)?

893


Write down the divisions of cobol program?

842


What are the access modes of START statement?

934