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 INITIALIZE what is Repalcing Word will do
write a program to eliminate duplicate records in a input file and send them to output file.
How to read records from flat file in reverse order through COBOL program?
14 Answers Accenture, Broadridge, IBM, MAT, Polaris, SPIC, Syntel, TCS, Wipro,
I have the file which is having the extension no as records. sample file will look like below. 2310 3410 3256 4350 3781 5408 I need to replace the record which is starting with 3 to 5 (i.e) 3410 to 5410. How can we do it through cobol and cobol-db2 program? I need the possible logic?
how can we code index in an array of cobol pgm?
What is the difference between a subscript and an index in a table definition?
Is It Possible to Update or change in VIEW Mode?
can anyone explain me the concept of COMP-4 PLEASE??
What are the different types of condition in cobol and write their forms.
how you read control card into array?
What is SSRANGE, NOSSRANGE ?
what modification we need to do in jcl if we use sort in cobol? I mean whether we need to include tempary file used for sorting in assign statement?