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

How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?

687


How many sections are there in data division in COBOL?

674


If you are current on the owner of a set, what is the difference between an obtain next and obtain first? Actually in which topic will we use dis???Plz explain it clearly

2654


In COBOL, what is the different between index and subscript?

751


Write the code implementing the perform … varying.

636






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

1639


i need a small 3d program using inline and outline.

1629


I have a File that has duplicate records. I need only those records that occur more than thrice.?

8605


Why is it necessary that file needs to be opened in I-O mode for REWRITE?

736


What are literals?

622


Are you comfortable in cobol or jcl?

633


What is difference between static and dynamic call in cobol?

766


I have File 1 occurs 5 times with Employee-ID,Employee-Name,Employee-Dept (EEE and MECH). I have File 2 occurs 10 times with Employee-ID,Employee-Name,Employee-Dept (EEE,CIVIL,CHEMICAL and MECH). In FIle 1 and FIle 2 , for matching Employee-DEPT (Only MECH) , we need to move entire records from file1 to file 2. We should not use 2D array. Your help is needed here.

1103


Explain what you understand by passing by value.

685


What is redefines clause in COBOL?

841