Use the SSRANGE compiler option to check whether addresses fall within proper ranges.
SSRANGE causes the following addresses to be checked:
If the SSRANGE option is in effect, checking is performed at run time if both of the following conditions are true:
If an address is generated outside the range of the data item that contains the referenced data, an error message is generated and the program stops. The message identifies the table or identifier that was referenced and the line number where the error occurred. Additional information is provided depending on the type of reference that caused the error.
If all subscripts, indices, and reference modifiers in a given data reference are literals and they result in a reference outside the data item, the error is diagnosed at compile time regardless of the setting of the SSRANGE option.
Performance consideration: SSRANGE can somewhat degrade performance because of the extra overhead to check each subscripted or indexed item.
related references
SSRANGE
Performance-related compiler options