How to Improve COBOL Table Lookup Performance

Don’t open the file until you need it:

The OPEN and CLOSE instruction generates a lot of excessive code, so the recommendation is to always put all of your files in the same OPEN and the same CLOSE. Well the default number of buffers in MVS is 5, so each file you open will consume 5 times the block size in “REAL Memory”.

This means that you have less available Memory for your job and other jobs that are running. This means that MVS has more of a challenge to divide up the resources.

It becomes more time consuming and more “staging drive” I/O bound when you have inefficient programs. So open that control file, read the record, then close it before you proceed to the main logic of the program. And if you have an internal SORT, then it is obvious, you don’t need all of those files open in both of the exits.

Use Binary if your table is larger:

If you have a very small table, then an unsorted table search is not so bad.

But the larger the table gets, the inefficiencies become exponentially harmful.

The SEARCH ALL does a binary search. Divide the table in half, check if above or below then go to the resulting half and repeat the division process.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.