Sunday, January 22, 2017

The compiler option SSRANGE

If you specify the SSRANGE compiler option, the COBOL compiler generates additional code that makes certain a table subscript or index does not address an area outside the boundaries of the associated table. This compiler option also generates code to ensure that OCCURS DEPENDING ON values, which are set dynamically by COBOL source code statements, do not go beyond the maximum boundaries initially defined for the associated variable-length table.

To invoke this option you need to code the parameter

COPT=SSRANGE

on the compile step of your job.

If you have compiled your program with the SSRANGE compiler option, subscript range checking will occur during program execution for all tables as they are referenced. If an "out of bounds" condition occurs, a diagnostic message is generated and the program is abnormally terminated. Subscript range checking occurs when a program is being executed because most table elements are referenced using computed subscripts or indexes rather than numeric literals. The default COBOL compiler option is NOSSRANGE. If your program is compiled with the SSRANGE option you have the option to cancel the checking performed at execution time. This is accomplished by specifying the NOSSRANGE execution time option as follows:

//RUN EXEC PGM=MYPROG,PARM='/NOSSRANGE'


You can tell NOSSRANGE is a run-time option rather than a compiler option because of the slash. It is recommended that you use the SSRANGE compiler option when you are testing programs. However because script range checking involves the execution of additional code, your program executes a little slower than it might. Therefore when programs are ready to be handed over for production running they should have the default compiler option of NOSSRANGE.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.