ERROR condition

Indicates that an error has been detected.

Enabled/Disabled status

Always enabled.

Result

Issues an error messages if no ON-unit is active when the ERROR condition arises, or if the ON-unit does not use a GOTO (to exit the block) to recover from the condition.

Raised

As a result of:
  • The implicit action for a condition, which is to raise the ERROR condition
  • The normal return action for some conditions, such as SUBSCRIPTRANGE CONVERSION or when no retry is attempted
  • A SIGNAL ERROR statement
  • An error (for which there is no other PL/I-defined condition) during program execution

Notes

The ERROR condition is the implicit action for many conditions, thus providing a common condition that can be used to check for a number of different conditions, rather than checking each condition separately.

Just prior to signaling the condition, the value of the ONCODE built-in function is set to an implementation-defined integer value that serves as an error code that indicates which error occurred. (For more information, see your Open PL/I User's Guide.)

Example

The following is an example of an ON ERROR statement.

ON ERROR BEGIN;
   PUT SKIP LIST ('AN UNIDENTIFIED ERROR OCCURRED'); 
END;

Other Information

Condition code
All codes 1000 and above.
Implicit action
Prints a message and raises a FINISHED condition.
Normal return
Returning from the ON-unit produces an error message and ends program execution by executing a STOP statement.