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
2 input fles: 2 flat files, with different number of records. both are having unique key for each record and already sorted in ascending order . match these files using unique key and in output only matching key value has to be written. please procide cobol logic
Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.
What is the difference between PIC 9.99 and 9v99 in COBOL?
what is difference bt COND, REGION & TIME parameters at JOB & EXEC. give an exp.
How did the release of cobol/370 version 1.3 improve the performance of release 1.1?
What are different data types in cobol?
How arrays can be defined in COBOL?
In COBOL programming, what is PERFORM? What is VARYING?
How you can characterize tables in cobol?
Explain how will you differentiate between an internal and an external sort, the pros and cons, internal sort syntax etc
Name the sections present in data division.
What is the difference between perform … with test after and perform … with test before?
What is difference between static and dynamic call in cobol?
1.give the details about WHEN OTHER. 2. how many form are available in evaluate.
What kind of error is trapped by on size error option?