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 |
Consider the following: 77 A PIC 9(10) 77 B PIC 9(10) 77 C PIC 9(19) MULTIPLY AB BY B GIVING C Which of the following is true ? (a) The execution of the above may result in size error. (b) The execution of the above will result in size error. (c) The definition of C is invalid resulting in compilation error. (d) No error will be thee and the program would proceed correctly.
I have program P1 which calls file F1 which has 100 records and following structure 001 .................. 002 .................. 003 .................. 098 .................... 099 ................... 100 .................... Now I want to read these files and write these records in file F2 in following manner. 001 ...... 051 ..... 002 ...... 052 ..... 003 ...... 053 ..... .......... ....... .......... ....... .......... ....... 048 ........ 098 ...... 049 .......... 099 ....... 050 .... 100 ......
can u give result for the fallowing example... 05 a pic 9(2) 05 b redifines a pic x(2). move 'xy' to b. display a,b.
How many times the loop runs here 01 a pic 9(2) value 1. perform para1 until a=10 move 1 to a. stop run. para1: move 10 to a.
In a COBOL program, 2 tables TABLE1 and TABLE2 are defined that are indexed by INDEX1 and INDEX2 respectively. Can we use INDEX1 with TABLE2 and INDEX2 with TABLE1?
how we can reverse the string in the cobol for example satheesh can be reveresed as hseehtas
Why occurs can not be used in 01 level ?
What is the difference between copy and include in cobol?
can u plz expain me how to declare dynamic array? what is the meaning of depending on clause in dynamic array?
In which area will you utilize 88 level items in cobol?
how can we code index in an array of cobol pgm?
What is inspect in cobol ?