Question

The Cobol's SEARCH keyword can be used to search one dimensional arrays indexed.

But I think this SEARCH is having some disadvantages when used for searching 2-d arrays. We can search using PERFORM loop also but is there a better way of utilizing SEARCH for 2-d arrays. Which one do you propose?

Was it helpful?

Solution

What disadvantages does it have? If your arrays are sorted you can use SEARCH ALL instead (it is using the binary search instead of a serial one). Either way, using the search statement is probably more consise than writing several nested perform loops.

Also take a look here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top