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 / 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 |
If a file has 1000 records.. if i have to replace the first and last characters of the file with another character. how it can be done....
What divisions, sections and paragraphs are mandatory for a COBOL program?
Explain about Redefines cluse?
The disposition parameter in the jcl is share ( DISP+SHR ) and the program opens file in extend mode what will happen?
how we rectify soc4 and soc7 error in project(need real time answer)? please reply
what is rediffine clause?in what situation it can use?give me real time example?
Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?
6 Answers ABC, IBM, Mphasis, Wipro,
What is the utilization of copybook in cobol?
What is the difference between Structured COBOL Programming and Object Oriented COBOL programming?
0 Answers TryTechnicals Pvt Ltd,
I have a variable account-number declared as comp-3, s9(10) comp-3 in a file. How do i find a particular account number say 123456 in that file?
How to read the last 100 records from a COBOL file. The file contains N number of records.
How do u debug a S0C7 abend? (aswered till we get the field which caused that) After knowing the field which caused that how do u know the record which caused that if it is in production env? (dumb) Ok let us assume that we got to know that 100th record caused that and I wanted to skip only 100th record from the file and process from 101th. How to do that in JCL using SORT? (tried with STOPAFT but ended up dumb when he said smthing else is ther)