OpenTP1 Version 7 Programming Reference COBOL Language

[Contents][Index][Back][Next]

TXROLLBACK - Roll back a global transaction

Format

DATA DIVISION.
*  Include TX definitions.
 01  TX-RETURN-STATUS.
     COPY  TXSTATUS.
 
 PROCEDURE DIVISION.
 CALL "TXROLLBACK" USING TX-RETURN-STATUS.

Description

TXROLLBACK is used to roll back the work of the transaction active in the caller's thread of control.

If the transaction_control characteristic (see TXSETTRANCTL) is

TX-UNCHAINED, when TXROLLBACK returns, the caller is no longer in transaction mode. However, if the transaction_control characteristic is

TX-CHAINED, when TXROLLBACK returns, the caller remains in transaction mode on behalf of a new transaction (see the Return value and Errors sections below).

Optional set-up

<<TXROLLBACK cannot be called from MHPs.>>

<<Data areas>>

<<TX-RETURN-STATUS

The results of TXROLLBACK execution are returned to this area.>>

Return value

Upon successful completion, TXROLLBACK sets TX-OK, a non-negative return value.

<<0 is returned.>>

<<A new global transaction is started if the transaction_control characteristic is TX-CHAINED.>>

<<If the SPP which has issued TXROLLBACK is not the root transaction branch, actual rollback is not conducted, but only the fact that the transaction branch is in the rollback_only state is recorded. Transaction mode remains in effect until a rollback instruction is given during synchronization point processing for the root transaction branch.>>

Errors

Under the following conditions, TXROLLBACK fails and sets one of these negative values.

TX-NO-BEGIN
The transaction rolled back; however, a new transaction could not be started and the caller is no longer in transaction mode. This return value occurs only when the transaction_control characteristic is TX-CHAINED.

TX-MIXED
The transaction was partially committed and partially rolled back. In addition, if the transaction_control characteristic is TX-CHAINED, a new transaction is started.

TX-MIXED-NO-BEGIN
The transaction was partially committed and partially rolled back. In addition, a new transaction could not be started and the caller is no longer in transaction mode. This return value can occur only when the transaction_control characteristic is TX-CHAINED.

TX-HAZARD
Due to a failure, the transaction may have been partially committed and partially rolled back. In addition, if the transaction_control characteristic is TX-CHAINED, a new transaction is started.

TX-HAZARD-NO-BEGIN
Due to a failure, the transaction may have been partially committed and partially rolled back. In addition, a new transaction could not be started and the caller is no longer in transaction mode. This return value can occur only when the transaction_control characteristic is TX-CHAINED.

TX-COMMITTED
The transaction was heuristically committed. In addition, if the transaction_control characteristic is TX-CHAINED, a new transaction is started.

TX-COMMITTED-NO-BEGIN
The transaction was heuristically committed. In addition, a new transaction could not be started and the caller is no longer in transaction mode. This return value can occur only when the transaction_control characteristic is TX-CHAINED.

TX-PROTOCOL-ERROR
The function was called in an improper context (for example, the caller is not in transaction mode).

TX-FAIL
Either the transaction manager or one or more of the resource managers encountered a fatal error. The nature of the error is such that the transaction manager and/or one or more of the resource managers can no longer perform work on behalf of the application. The caller's state with respect to the transaction is unknown.

See also

TXBEGIN, TXSETTRANCTL, TXSETTIMEOUT.

<<Notes on use with OpenTP1>>

  1. <<If the transaction_control characteristic is TX-CHAINED, only the root transaction branch (the UAP which has called TXBEGIN) can call TXROLLBACK.>>
  2. <<If the transaction_control characteristic is TX-UNCHAINED, TXROLLBACK can be called by no-root transaction branches. However, processing varies depending on the caller is a root or non-root transaction branch. If the caller is the root branch, it requests non-root branches via RPC for rollback. If the TXROLLBACK caller is a non-root branch, the caller only records rollback_only and does not call a rollback request via RPC to the root branch. The caller non-root branch will initiate rollback after it is instructed by the root branch.>>
  3. <<TXROLLBACK cannot be used along with OpenTP1 CBLDCTRN. >>