Run-time Errors

If an error occurs at run time, a message appears on the terminal.

You can use Open PL/I's ON statement to develop handlers for the conditions that can occur in your program. The ON ERROR statement can be used for arbitrary errors. The ONLOC built-in function can be used in an ON-unit to report the name of an entry in which a condition was raised, and the ONCODE built-in function can be used to report the status value of a run-time error.

Note:

If an error is not caught by an ON-unit, Open PL/I displays the source file and line number where the error occurred. For these features to work, however, you must have compiled the source file with the default option -unixdebug.

This feature is currently available only in the Sun Solaris 2 and IBM AIX versions of Open PL/I.

When a fatal error condition occurs at run time, a message is displayed naming the condition that has been raised; the program address where this occurred; and the source file, entry, and line number at which the condition was raised, as well as the lines in each procedure above it in the call stack. For example:

*** Condition ERROR raised 
***Unhandled condition ZERODIVIDE at PC=00010233 
CALCDIV line 26 in /dirl/dir2/calcs.pl1 
SUBR3 line 444 in /dirl/dir2/subprog.pl1 
MYPROG line 871 in /dirl/dir2/mainprog.pl1

In this example,

CALCDIV Is the entry in which the "ZERODIVIDE" condition was raised.
SUBR3 Is the entry that called "CALCDIV" (at line 444).
MYPROG     Is the program that called SUBR3.

If you have compiled your program using the -nounixdebug option, only the program address where the condition was raised will be displayed:

*** Condition ERROR raised 
*** Unhandled condition ZERODIVIDE at PC=00010233

CICS Error Handling

The following applies to CICS error handling only:

  • The EXEC CICS HANDLE ABEND statement has no effect on PL/I condition handling.
  • If the program has no ON units established, the PL/I run-time writes a message about abnormal program termination to the CPLI Transient Data Queue (TDQ) and terminates the transaction normally. The terminal is placed in a ready state with no indication of any abend.
  • Conditions detected by CICS (e.g., invalid storage length) drive the abend exit, if one has been established, via use of EXEC CICS HANDLE ABEND. PL/I ON units do not get control. If EXEC CICS HANDLE ABEND is not established, action taken is as defined by CICS, which normally leads to a transaction abend.
Notes:
  • If the program DISPLAYs messages or PUTs any stream PRINT output to SYSPRINT, it is written to CPI TDQ; however, we do not recommend using these methods.
  • PLIDUMPs requested by a program are written to CPLD TDQ.
  • You can browse TDQs using the CICS CEBR transaction.