Example of Optimized Subscripts to Table Elements

The following code shows the use of optimized subscripts:

 01 a pic xx occurs 10.
 01 b pic xx occurs 10.
 01 c pic xx occurs 10.
 01 d pic xx occurs 10.
  ...
     move a(i) to b(i)
     if c(i) = d(i)
         display "pass"
     end if

The result would be that the subscript i would be evaluated only once, although it is used four times in two statements. The stride of each of these tables is the same: two.