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 |
in how many mode we can open a file ?
) How do u handle errors in BMS macro
How arrays can be defined in COBOL?
How many sections are there in data division in COBOL?
How can you pass values from COBOL program to non-COBOL programs?
01 a pic x(6) value is abcdef 01 b pic x(3) move a to b wht will be the value in b ?
how do you reference the rrds file formats from cobol programs
How can we find out wether to declare the data items like Integer, Char,Comp? If comp types how can we decide wether it is Comp and Comp3.How it is? Please Explain... Cheers.
how to display the dataset information?
How do you do in-line PERFORM?
What are differences between COBOL and java ? why we are giving more preference to COBOL ?
if a file has 1000 recods how copy the records from 1 to 100 records using sort