If your program terminates abnormally without an accompanying run-time diagnostic message, the error that caused the failure probably also prevented the message from being displayed. Possible causes of this type of behavior are:
dcl array(10);
.
.
.
do I = 1 to 100;
array(I) = value;
You can detect this type of error in a compile module by enabling
the SUBSCRIPTRANGE condition. Each attempt to access an element
outside the declared range of subscript values should raise the
SUBSCRIPTRANGE condition. If there is no ON-unit for this condition,
a diagnostic message prints and the ERROR condition is raised.
Though this method is costly in terms of execution time and storage space, it is a valuable program testing aid. For more information on error handling, see Using error and condition handling for debugging.
Make sure that locator values created in one program, transmitted to a data set, and subsequently retrieved for use in another program, are valid for use in the second program.
dcl a static,b based (p); allocate b; p = addr(a); free b;
dcl x char(3); i = 3 substr(x,2,i) = 'ABC';To detect this type of error in a compiled module, use the STRINGRANGE condition (for more information, see Conditions used for testing and debugging).