SSRANGE
Use SSRANGE to generate code that checks for out-of-range storage references.
Default is: NOSSRANGE
Suboption default is: NOZLEN,ABD
if
only SSRANGE
is specified.
Abbreviations are: SSR
| NOSSR
SSRANGE
generates
code that checks whether subscripts, including ALL
subscripts,
or indexes try to reference areas outside the region of their associated
tables. Each subscript or index is not individually checked for validity.
Instead, the effective address is checked to ensure that it does not
reference outside the table.
If
you specify SSRANGE
with no suboptions, it will be
accepted as a specification of SSRANGE(NOZLEN,ABD)
.
SSRANGE
option
is in effect, range checks will be generated by the compiler and the
checks will always be conducted at run time. You cannot disable the
compiled-in range checks at run time by specifying the runtime option CHECK(OFF)
.Variable-length items are also checked to ensure that references are within their maximum defined length.
Reference modification expressions for non-UTF-8 data items and function values are checked to ensure that:
- The starting position is greater than or equal to 1.
- The starting position is not greater than the current length of the subject data item.
- The starting position and length value (if specified) do not reference an area beyond the end of the subject data item.
- The length value (if specified) is greater than or equal to 1.
ZLEN
and NOZLEN
suboptions
control how the compiler checks reference modification lengths:- If
ZLEN
is in effect, the compiler will generate code to ensure that reference modification lengths are greater than or equal to zero. Zero-length reference modification specifications will not get anSSRANGE
error at run time. - If
NOZLEN
is in effect, the compiler will generate code to ensure that reference modification lengths are greater than or equal to 1. Zero-length reference modification specifications will get anSSRANGE
error at run time. This is compatible with howSSRANGE
behaved in previous COBOL versions.
MSG
and ABD
suboptions
control the runtime behavior of the COBOL program when a range check
fails.- If
MSG
is in effect and a range check fails, a runtime warning message will be issued. Also, the affected statements will still be executed. The program will continue and might potentially identify other out-of-range conditions. - If
ABD
is in effect and a range check fails, the first out-of-range condition will result in a runtime error message and the program will ABEND. You can find the next potential out-of-range condition by fixing the first out-of-range condition and then recompiling and running the program again. To identify all other potential out-of-range conditions, you might need to repeat this process several times.
For unbounded groups or their subordinate items, checking is done only for reference modification expressions. Subscripted or indexed references to tables subordinate to an unbounded group are not checked.