Example of Optimizing USAGE DISPLAY Subscripts

The following code shows the use of USAGE DISPLAY subscripts:

  ...
 01 array   pic x occurs 20.
 01 array-index pic 9(5) value 2.
  ...
     move "a" to array(array-index).
  ...

If the program is compiled without BOUNDOPT, all five digits of array-index are used to evaluate the subscript. If BOUNDOPT is specified, only the last two digits of array-index are used, as only two digits are needed to access all elements of a 20 element table. However, it is much more efficient to use comp-5 subscripts.