Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Cobol 的 SEARCH 关键字可用于搜索索引的一维数组。
但我认为这个 SEARCH 在用于搜索二维数组时有一些缺点。我们也可以使用 PERFORM 循环进行搜索,但是否有更好的方法将 SEARCH 用于二维数组。你建议哪一个?
它有什么缺点?如果您的数组已排序,则可以使用 SEARCH ALL 代替(它使用二进制搜索而不是串行搜索)。无论哪种方式,使用搜索语句可能比编写多个嵌套执行循环更简洁。
也看看这里。