When defining tables, a subscript should be a COMP-5 item of the smallest optimum size that accommodates the range of values involved. The optimal size for a subscript is four bytes.
Subscripts for items that have the same stride and which are used in consecutive statements are optimized so that they are only evaluated once.
When you compile a program for use in production, use the NOBOUND directive. Use BOUND only when debugging. It causes code to be generated every time a subscript or index is used, to check that it is within the defined bounds of the table.
If you are using USAGE DISPLAY subscripts, the BOUNDOPT directive (also switched on by NOBOUND) can improve performance.
Access to tables defined with OCCURS ... DEPENDING is less efficient than access to tables of fixed size, and so should be avoided where high performance is needed.
Bound checking on a variable length table checks only if the subscript or index points outside the maximum length of the table. It does not take account of the table's current length (that is, the value of the item specified in the DEPENDING phrase).