OpenTP1 Version 7 Programming Reference COBOL Language

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

TXCLOSE - Close a set of resource managers

Format

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

Description

TXCLOSE closes a set of resource managers in a portable manner. It invokes a transaction manager to read information specific to the resource manager in a manner specific to the transaction manager and pass this information to the resource managers linked to the caller.

TXCLOSE closes all resource managers to which the caller is linked. This function is used in place of close calls specific to the resource manager and allows an application program to be free of calls, which may hinder portability. Since resource managers differ in their termination semantics, the specific information needed to close a particular resource manager must be published by each resource manager.

TXCLOSE should be called when an application thread of control no longer wishes to participate in global transactions. TXCLOSE fails (returning TX-PROTOCOL-ERROR) if the caller is in transaction mode. That is, no resource managers are closed even though some may not be participating in the current transaction.

When TXCLOSE sets success (TX-OK), all resource managers linked to the calling thread are closed.

<<Data areas>>

<<TX-RETURN-STATUS

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

Return value

Upon successful completion, TXCLOSE sets TX-OK, a non-negative value. <<0 is returned.>> <<The set of resource managers linked to the TXCLOSE caller is closed.>>

Errors

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

TX-PROTOCOL-ERROR
The function was called in an improper context (for example, the caller is in transaction mode). No resource managers are closed.

TX-ERROR
Either the transaction manager or one or more of the resource managers encountered a transient error. The exact nature of the error is determined in a product-specific manner. All resource managers that could be closed are closed.

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.

See also

TXOPEN.

<<Notes on use with OpenTP1>>

  1. <<TXCLOSE can close only resource managers complying with the X/Open XA interface.>>