Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?

1178


Which is not true about evaluate statement

2432


What are declaratives and what are their uses in cobol?

1184


How to print 10 to 1 if the input have only 10 digit number?

1243


What is redefines clause in COBOL?

1275


How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?

1118


How do u write test cases?

2051


Which mode is used to operate the sequential file?

1180


How do we get current date from system with century in COBOL?

1357


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?

2557


What is the difference between perform … with test after and perform … with test before?

1412


How did the release of cobol/370 version 1.3 improve the performance of release 1.1?

1068


Is it possible that the redefines clause has different picture clauses compared to the one it redefined?

1135


Difference between cobol and cobol-ii?

1250


What is the difference between goback, stop run and exit program in cobol?

1572