Tutorial :Is there a better way to use SEARCH in two-dimensional arrays of COBOL?



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?


Solution:1

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.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »