try

The EGL try statement indicates that the program continues running if a statement of any of the following kinds results in an error and is within the try statement:
  • An input/output (I/O) statement
  • A system-function invocation
  • A call statement
If an exception occurs, processing resumes at the first statement in the onException block (if any), or at the first statement following the end of the try statement. A hard I/O error, however, is handled only in the following cases:
  • If the system variable VGVar.handleHardIOErrors is set to 1 and any hard I/O error occurs; or
  • If the system variable DLIVar.handleHardDLIErrors is set 1 and the hard I/O error occurs during access of a DL/I database or IMS™ message queue.

Otherwise, the program displays a message (if possible) and ends.

A try statement has no effect on runtime behavior when an exception occurs in a function or program that is invoked from within the try statement.

For other details, see Exception handling.


Syntax diagram for the try statement
statement
Any EGL statement.
OnException
A block of statements that run if an exception condition occurs.
Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.