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 Posted / 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 |
Post New Answer View All Answers
How can you get the ksds file records into your cobol program?
Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc
How arrays can be defined in COBOL?
input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.
What is rmode(24)
) How do u handle errors in BMS macro?
How do you get the data to code the BMS macro?
what is difference between cobol and cobol/400
how do you reference the esds vsam file formats from cobol programs
How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?
What are various search techniques in cobol? Explain.
What is the difference between external and global variables in COBOL?
What is the compute verb? How is it used?
What happens when we move a comp-3 field to an edited (say z (9). Zz-)?
) what is the difference between AID and HANDLE AID?