In COBOL, SSRANGE and NOSSRANGE are compiler directives that control array subscript range checking during program execution.
SSRANGE (Subscript Range Checking)
SSRANGE is a compiler option that enables array subscript range checking. When SSRANGE is specified, the compiler performs bounds checking on array indices or subscripts at runtime. If the program attempts to access an element outside the defined boundaries of the array, it triggers a runtime error, helping to prevent array index out-of-bounds errors. SSRANGE adds an extra layer of safety by ensuring that array access is within the permissible limits.
NOSSRANGE (No Subscript Range Checking)
NOSSRANGE is another compiler option that disables array subscript range checking. When NOSSRANGE is used, the compiler skips the bounds check during program execution. This means that the program can freely access elements in the array without being restricted by any index boundaries. However, disabling subscript range checking comes with a trade-off; it increases the risk of potential array index out-of-bounds errors if the program does not handle array access carefully.