Previous Topic

Next Topic

Book Contents

Book Index

Exception Handling

KOA scripts can communicate with any VTAM application that runs in the SNA network. This type of operating environment is very dynamic, and various events can occur during KOA operation. Therefore, scripts should be designed to handle potential exceptions.

The KOA language supplies the following variables that provide the cause of an exception:

Table 25 KOA Exception Handling Variables

Variable

Description

%VTAMRC

Contains the error ID.

%VTAMERR

Provides a short description of the error ID.

%VTAMFDBK

Supplies VTAM return codes which explain the situation.

To simplify script design, it is recommended that a general exception handling section be included in the script. This section should establish exception handling procedures for any possible exception, thus eliminating the need to check the result (successful, or unsuccessful) of each individual communication operation.

Command ON SCREENERROR allows specification of a label to which script flow branches if a communication operation is unsuccessful. Flow can be directed to different exception handling sections throughout the script. This is achieved by specifying different labels as parameters to command ON SCREENERROR at different points in the script. A script can also execute without any exception handling section (by specifying command ON SCREENERROR without parameters). In this last case, no exception handling procedures are initiated when an exception occurs.

The exception handling routine usually examines the three KOA variables listed above to check the cause of the exception.

There are two exceptions that are not controlled by the general exception handling section of a script:

When the session receives an unexpected (unsolicited) message, and command SCREENMODE GETUNSOL was specified. In this case, KOA variable %VTAMERR contains the value UNSOLMSG.

When command GETSCREEN is specified, but no data is available from the VTAM application. In this case, KOA variable %VTAMERR contains the value NODATA.

For these two situations, design the script so that it checks return codes after each communication operation.

Parent Topic

KOA Implementation Considerations