Value Table for ONCODE Built-in Function

You may use the ONCODE built-in function in any unit to determine the nature of the error condition that caused invocation of that ON-unit. This topic lists the values returned by the ONCODE built-in function and the errors or conditions corresponding to each value.

Important: The value returned by ONCODE for some conditions is implementation-dependent; in fact, some conditions that occur on one implementation may not be raised at all on another implementation, even by an identical source program run on both implementations. Further, subsequent releases of Open PL/I may change these ONCODE values. Therefore, to make programs more portable, avoid writing Open PL/I programs that depend on specific ONCODE return values to function properly; failing that, use replace constants to represent needed values so that implementation-specific values can be changed easily.

For more information on ON conditions, see the ON and ONCODE Function topics.

Code Meaning
0 ONCODE has been used outside of an active ON-unit

System-Defined Condition Codes

Code Meaning
001 – 099      A UNIX system error has occurred; the value returned corresponds exactly to the UNIX system error codes as listed in your system documentation.
100 – 89999      A run-time error has occurred; the value returned corresponds exactly to the Open PL/I run-time error codes, as documented in PL/I Run-time Error Codes. (Note that 89999 is the highest possible error number and that not all error numbers are currently being used.)
9250 A fetchable procedure was not found.

Signal Condition Codes

Code Meaning
90000 Shell exit for any reason other than UNIX signals, including EOF.
90nnn Signal number nnn has been caught by the run-time system. The value nnn corresponds exactly with the signal number as defined in your system documentation, except for the following signals:

SIGINT – Treated as PL/I ATTENTION condition.

SIGFPE – Treated as computational error condition.

PL/I Condition Codes

Code Meaning
310 FIXEDOVERFLOW
8097[1] A FIXED DECIMAL variable has invalid data.
99001 ERROR condition raised by SIGNAL ERROR statement.
99011 FINISH condition
99020 ATTENTION condition
99110 ENDFILE condition
99120 ENDPAGE condition
99130 KEY condition
99140 UNDEFINEDFILE condition
99150 RECORD condition
From 99151 - 340 SIZE condition is triggered
99200 Computational error; some operating systems indicate the precise cause of the error, in which case ONCODE will return the number corresponding to the more specific error description.
99203 ZERODIVIDE condition
99204 SUBSCRIPTRANGE condition
99205 CONVERSION condition
99206 CONDITION condition
99207 AREA condition
99210 INVALID OPERAND condition
99211 INVALID_ADD_SUBTRACT condition
99212 INVALID_MULTIPLY condition
99213 INVALID_DIVIDE condition
99214 INVALID_MOD condition
99215 INVALID_COMPARISON condition
99251 INVALID_SQRT condition
99252 INVALID_ASIN_ACOS condition
99253 INVALID_ATAN2 condition
99254 INVALID_LOG condition
99255 INVALID_POWER condition
99256 INVALID_ATANH condition
99257 INVALID_COMPLEX_OPERAND condition
99301 Stack unwind condition raised during non-local GOTO. This corresponds to the SS$_UNWIND value.
99310 STRINGRANGE condition
Important: Micro Focus PL/I conditions emulate mainframe PL/I conditions.