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 is the diff b/w select stsmt and cursor ?
explain sorting techniques in cobol program?
What is SDSF?
What is sqlca and why is it needed in any cobol-db2 program?
Have you code any new programs in COBOL ? What is the functionality of the programs?
Can JUSTIFIED be used for all the data types?
The maximum number of dimensions that an array can have in COBOL-85 is ?
COMPUTE X = A * B - C * D and COMPUTE X = (A * B) - (C * D) (a) Are not the same (b) Are same (c) Syntactically wrong (d) Will yield a run time error
COBOL program to read the string ' BOMBAY' in reverse order as 'YABMOB'
What is redefines clause in COBOL?
what is soc7 abend?how u can trace it?
What is the Purpose of POINTER Phrase in STRING command