OpenTP1 Version 7 Programming Reference COBOL Language

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

TXCOMMIT - Commit a global transaction

Format

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

Description

TXCOMMIT is used to commit the work of the transaction active in the caller's thread of control.

If the transaction_control characteristic (see TXSETTRANCTL) is

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

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

Optional set-up

<<Data areas>>

<<TX-RETURN-STATUS

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

Return value

Upon successful completion, TXCOMMIT sets TX-OK, a non-negative return value. <<0 is returned.>> <<If the transaction_control characteristic is set to TX-CHAINED, a new transaction is started.>>

Errors

Under the following conditions, TXCOMMIT fails and sets one of these negative values:

TX-NO-BEGIN
The transaction committed successfully; 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-ROLLBACK
The transaction could not commit and has been rolled back. In addition, if the transaction_control characteristic is TX-CHAINED, a new transaction is started.

TX-ROLLBACK-NO-BEGIN
The transaction could not commit and has been 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-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 will also be returned if 00000001 is assigned to the trn_extend_function operand in the transaction service definition and if the resource manager returns XAER_NOTA after a one-phase commit.

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-HAZARD-NO-BEGIN will also be returned if 00000001 is assigned to the trn_extend_function operand in the transaction service definition and if the resource manager returns XAER_NOTA after a one-phase commit.

TX-PROTOCOL-ERROR
The function was called in an improper context (for example, the caller is not in transaction mode). The caller's state with respect to transaction mode is not changed.

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, TXSETCOMMITRET, TXSETTRANCTL, TXSETTIMEOUT.

<<Notes on use with OpenTP1>>

  1. <<TXCOMMIT can be called only by processes of the UAP which has started the global transaction (the UAP which has issued TXBEGIN).>>
  2. <<Processes which call TXCOMMIT must have activated UAP executable files which are correctly linked according to the description in this manual.>>
  3. <<TXCOMMIT cannot be used along with OpenTP1 CBLDCTRN.>>