We are using the searching a table which is indexed, once
the key is found, how can we get the occurance at which the
key was found.
Answer / shobhit
Initialize the index and a variable to 1 before search.
SET IDX VAR-POS TO 1.
SEARCH TABLE VARYING VAR-POS
AT END DISPLAY "Not Found"
WHEN TABLE(IDX) = <SEARCH STRING>
MOVE VAR-POS TO RESULT-VAR
DISPLAY "FOUND AT POSITION" RESULT-VAR
END-SEARCH.
Now the position is available in the variable RESULT-VAR.
| Is This Answer Correct ? | 5 Yes | 0 No |
What are all the divisions of a COBOL program?
What is COMP SYNC?
Explain the difference between an internal and an external sort, the pros and cons, internal sort syntax etc.
How to use the same COBOL program in Batch and CICS on lines? explain with an example
The order of precedence of arithmetic operators in an expression can be overridden with the use of (a) [] (b) () (c) {} (d) Any of the above
i have a variable block which is used in my cobol program as input file having records of 4080 after compilation while runing the program im getiing file attribut mismatch and it is saying tht the record length of the file is 4084 can any one knw the answer how to reslove it ?
how to transfer the file from pc to mainframe??
I have a cobol program with a sub program. How ca i find that it is a dynamic call? or static call..?
we can use set true for condition names.. similarly can we code set to false in cobol pgm? will it work?
can we use full outer join with cursors declared in cobol program?
When is inspect verb is used in cobol?
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?