CICS exception handling in Java programs

CICS ABENDs and exceptions are integrated into the Java exception-handling architecture. All regular CICS ABENDs are mapped to a single Java exception, AbendException, whereas each CICS condition is mapped to a separate Java exception.

This leads to an ABEND-handling model in Java that is similar to the other programming languages; a single handler is given control for every ABEND, and the handler has to query the particular ABEND and then decide what to do.

If the exception representing a condition is caught by CICS itself, it is turned into an ABEND.

Java exception-handling is fully integrated with the ABEND and condition-handling in other languages, so that ABENDs can propagate between Java and non-Java programs, in the standard language-independent way. A condition is mapped to an ABEND before it leaves the program that caused or detected the condition.

However, there are several differences to the abend-handling model for other programming languages, resulting from the nature of the Java exception-handling architecture and the implementation of some of the technology underlying the Java API:
Note: CICS requires the Language Environment® product to be installed and active on your OS/390® system in order to run Java applications. You should not specify the Language Environment run-time option TRAP=OFF, because this will disable abend handling in JCICS.
There are three CICS-related class hierarchies of exceptions:
  1. CicsError, which extends java.lang.Error and is the base for AbendError and UnknownCicsError.
  2. CicsRuntimeException, which extends java.lang.RuntimeException and is in turn extended by:
    AbendException
    Represents a normal CICS ABEND.
    EndOfProgramException
    Indicates that a linked-to program has terminated normally.
    TransferOfControlException
    Indicates that a program has used an xctl() method, the equivalent of the CICS XCTL command.
  3. CicsException, which extends java.lang.Exception and has the subclass:
    CicsConditionException.
    The base class for all CICS conditions.