EXCEPTION

Use the EXCEPTION statement to check for a specified exception condition and identify the script that is to handle the exception when it occurs. The exception condition is described by an exception definition script and is handled by an exception handler script. An EXCEPTION statement is active for the duration of a script, continuously checking for the specified exception condition in the background while the main script is running.

Exception definitions and handlers are similar to normal scripts; however, they do not accept input parameters, and they do not return anything except the script return code.

The following are examples of exception conditions:

Blueworx Voice Response provides the following built-in exception definition scripts.

EX_MATH_ERROR
Computation error (for example, divide by zero or overflow).
EX_NO_SCRIPT
Called script does not exist.
EX_NO_FIELD
Referenced field does not exist.
EX_KEYB_LOCK
3270 keyboard locked to attempts to input data (using SEND_KEY or PUT_FIELD).
EX_CHECK_SCREEN
CHECK_SCREEN failed with no match.

When any of these conditions occur, the script is aborted. If you want to handle a specific condition differently, you need to write an exception handler for that condition.

The EXCEPTION statement is necessary only when you specify your own exception definition or exception handler. If you do not include an EXCEPTION statement in a script, Blueworx Voice Response handles exceptions in the “default” manner; that is, if a condition specified by one of the built-in exception definition scripts is encountered, the script is aborted.

EXCEPTION statements must appear after the INPUT and OUTPUT statements.

If either of the exception definition or exception handler script names specified in the EXCEPTION statement is not found, the EX_NO_SCRIPT exception definition script is invoked. By default, the script is abnormally terminated. To handle a failed EXCEPTION statement in a different way, you need to write an exception handler for this condition.

Syntax


This picture shows the syntax of the EXCEPTION statement.

Examples

EXCEPTION My_exception_definition, My_exception_handler;
EXCEPTION EX_NO_SCRIPT, No_script_handler;

Procedure

To use the 3270 Script window’s Statements menu to define an EXCEPTION statement, follow this procedure:

  1. From the Welcome window, click on Applications —> 3270 Servers
  2. Selecting the EXCEPTION statement : Click Statements —> Exception.

    The system displays the Exception Statement Definition window.

  3. Specifying the exception definition and handler : Type the name of your exception definition script in the Exception Definition field, or click Exception Definition to display the Exception Definition Script window to select the script.

    In the Exception Definition Script window:

    • Click the button next to System Server if the definition script is defined to the 3270 server named system. Scripts and screens defined to the system server can be accessed by all Blueworx Voice Response applications.
    • Click the Built-in Definitions pushbutton if the definition script is one of the system-defined scripts described on the previous page.
    • Click the Detail pushbutton to show the description of the selected script.
  4. Type the name of your exception handler script in the Exception Handler field, or click Exception Handler to display the Exception Handler Script window to select the script.

    In the Exception Handler Script window:

    • Click the button next to System Server if the handler script is defined to the 3270 server named system. Scripts and screens defined to the system server can be accessed by all Blueworx Voice Response applications.
    • Click the Detail pushbutton to show the description of the selected script.
  5. Adding the statement to the script : Click OK.

    The EXCEPTION statement is added to the script.