Use SSRANGE to generate code that checks for out-of-range storage references.
Suboption default is:
SSRANGE is specified.
code that checks whether subscripts, including
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
no suboptions, it will be accepted as a specification of
SSRANGEoption is in effect, range checks are generated by the compiler and the checks are always conducted at run time. You cannot disable the compiled-in range checks at run time by specifying the runtime option
Variable-length items are also checked to ensure that references are within their maximum defined length.
Reference modification expressions 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 length value (if specified) is greater than or equal to 1.
- The starting position and length value (if specified) do not reference an area beyond the end of the subject data item.
NOZLENsuboptions control how the compiler checks reference modification lengths:
ZLENis 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 an
SSRANGEerror at run time.
NOZLENis 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 an
SSRANGEerror at run time. This is compatible with how
SSRANGEbehaved in previous COBOL versions.
ABDsuboptions control the runtime behavior of the COBOL program when a range check fails.
MSGis 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.
ABDis 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.
Checking for valid ranges