CHECK

The CHECK option specifies whether the compiler should generate special code to detect various programming errors.

Read syntax diagramSkip visual syntax diagram
             .-+---+-----------------.      
             | '-,-'                 |      
             V   .-NOCONFORMANCE-.   |      
>>-CHECK--(----+-+-CONFORMANCE---+-+-+--)----------------------><
               | .-NOSTORAGE-.     |        
               '-+-STORAGE---+-----'        

ABBREVIATIONS: STG, NSTG

CONFORMANCE | NOCONFORMANCE
Specifying CHECK(CONFORMANCE) causes the compiler to generate, under the following circumstances, code that checks at run time if the attributes of the arguments passed to a procedure match those of the declared parameters:
  • If a parameter is a string (or an array of strings) declared with a constant length, then the STRINGSIZE condition will be raised if the argument passed does not have matching length.
  • If a parameter is a string (or an array of strings), then the STRINGSIZE condition will be raised if the argument does not have the same length type (VARYING, NONVARYING or VARYINGZ).
  • If a parameter is an array (of scalars or structures), then the SUBSCRIPTRANGE condition will be raised if any constant bounds do not match those of the passed argument. The SUBSCRIPTRANGE condition will also be raised if all the extents are constant and the size and spacing of the array elements in the argument do not match those in the parameter. Arrays inside a structure are not checked.
  • If a parameter is a structure or union with constant extents, then the SUBSCRIPTRANGE condition will be raised if the offset of the last element does not match that of the passed argument.
  • If the procedure has the RETURNS BYADDR attribute and that attribute specifies a string type, then the STRINGSIZE condition will be raised if the string passed for the RETURNS value does not have matching length.

This extra code will not be generated if any of the following conditions are true:

  • The NODESCRIPTOR option applies to the procedure.
  • The block contains ENTRY statements.
  • Start of changeThe CMPAT(LE) option is in effect.End of change
STORAGE | NOSTORAGE
When you specify CHECK(STORAGE), the compiler calls slightly different library routines for ALLOCATE and FREE statements (except when these statements occur within an AREA).
Note: The STORAGE suboption is not supported under the LP(64) option.

The following built-in functions, described in the PL/I Language Reference, can be used only when CHECK(STORAGE) has been specified:

  • ALLOCSIZE
  • CHECKSTG
  • UNALLOCATED

AMODE(24) is not recommended for Enterprise PL/I applications. For code compiled with the CHECK(STORAGE) option, if you have to use AMODE(24), you must also specify the HEAP(,,BELOW) runtime option.