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
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.
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
Hi pls anybody tell me about " ANALYSIS DOCUMENT PREPARATION AND ESTIMATION OF TASK " (in real time project)."I want to update a sequential file in my project" for that purpose i need both structures i mean analysis document and estimation of task.
What are the different open modes available in cobol?
i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?
What are the pertinent COBOL commands?
How did the release of cobol/370 version 1.3 improve the performance of release 1.1?
how do you reference the variable unblock file formats from cobol programs
Can we redefine the field of x(200) to less than 200?
What are INPUT PROCEDURE and OUTPUT PROCEDURE?
What is cobol?
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?
how we sort two input files based on a common column and giving one o/p file please send me the coding logic?
What is the utilization of copybook in cobol? Could we utilize a similar copybook?
What is the utilization of copybook in cobol?