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 |
Write a program to enter and display the names of students in a class using the occurs clause.
What is the difference between a binary search and a sequential search? What are the pertinent cobol commands?
COBOL program to read the string ' BOMBAY' in reverse order as 'YABMOB'
What is different between variable length and fixed length?
what is the use of comp2 ? where can we use it with example ?
What are the access modes of START statement?
What is EIBCALEN? Why it is used?
study the following 01 A PIC 99V0 VALUE 5 01 B PIC 9V9 VALUE 6 01 C PIC 99V9 VALUE 2.5 01 D PIC 99 VALUE 3 COMPUTE A ROUNDED B C = A+B*C/D ON SIZE ERROR PERFORM PRINT-ERROR the comments of A.B.C after execution of the above statement are a.A=10 B=0 C=10 b.A=10 B=9.9 C=9.9 c.A=10 B=0 C=9.9 d.A=10 B=6 C=10
how will u pass dadta to cobol+db2 program...?
Hi, My interviewer ask A calls B and C calls B, a and b are static c and b are dynamic.what happens if they compile and execute at same time.
what is Pic 9v99 Indicates?
What is the difference between SEARCH and SEARCH ALL?