Error handling and abnormal termination support (Java)
EXEC CICS API commands are replaced by the CICS® Java™ API .
- ABEND
- To initiate an ABEND, invoke the Task.abend(String) method and supply an ABEND code. This causes an abend state to be set in CICS and an AbendCondition to be thrown. If the AbendException is not caught and propagates back to CICS, the exception is turned into normal CICS ABEND, which can be handled by an ABEND handler (if any is registered in the calling program), or it results in termination and rollback of the transaction.
- ABEND CANCEL
- To initiate an ABEND that cannot be handled, invoke the Task.force.Abend(String) method and supply an ABEND code. This causes an AbendError exception to be thrown, which can still be caught for notification purposes, but must be rethrown. The underlying state in CICS is ABEND_CANCEL, which results in termination and rollback of the transaction. It cannot be handled by calling programs.
- HANDLE ABEND
- To handle an ABEND from a program in any language, use a Java try-catch block with AbendException in the catch clause.
- HANDLE CONDITION
- To handle a particular condition, use a catch clause that names the associated exception. For example, to handle the PGMIDERR condition, catch InvalidProgramIDException. Alternatively, catch CicsConditionException to take a single course of action for all conditions.
- IGNORE CONDITION
- This command is not relevant to Java applications.
- POP HANDLE and PUSH HANDLE
- These commands are not relevant to Java applications. The Java exceptions that are used to prevent CICS ABENDs and conditions can be caught by any catch block that is in scope.