xa_commit()--Commit an XA Transaction Branch (Transaction Scoped Locks
Syntax
#include <xa.h> int xa_switch.xa_commit_entry(XID *xid, int rmid, long flags);
Default Public Authority: *USE
Service Program: QTNXADTP
Threadsafe: Yes
A transaction manager calls xa_commit() to commit the work associated with *xid. All changes that were made to resources managed by DB2® for IBM® i during the transaction branch are made permanent.
Parameters
- xid
- (Input) A pointer to the transaction branch identifier. This identifier was
generated by the transaction manager when the transaction branch was
started.
- rmid
- (Input) An integer value that the transaction manager generated when
calling xa_open(). The rmid identifies the resource
manager.
- flags
- (Input) Following are the valid settings of flags.
TMNOWAIT: 0x10000000L Do not commit the transaction if a blocking condition exists.
TMONEPHASE: 0x40000000L Use the one-phase commit optimization for the specified transaction branch.
TMNOFLAGS: 0x00000000L Use if no other flags are set.
Authorities
None
Return Value
The following values may be returned only if TMONEPHASE(0x40000000L) was set in the flags parameter.
100 | [XA_RBROLLBACK]
The transaction branch was rolled back for an unspecified reason. |
101 | [XA_RBCOMMFAIL]
A communications failure occurred within the resource manager. |
102 | [XA_RBDEADLOCK]
A deadlock condition was detected within the resource manager. |
103 | [XA_RBINTEGRITY]
The resource manager detected a violation of the integrity of its resources. |
104 | [XA_RBOTHER]
The resource manager rolled back the transaction branch for a reason not on this list. |
105 | [XA_RBPROTO]
A protocol error occurred in the resource manager. |
106 | [XA_RBTIMEOUT]
A timeout occurred in the resource manager. |
107 | [XA_RBTRANSIENT]
A transient error was detected in the resource manager. |
The following values may be returned for all flags settings.
-7 | [XAER_RMFAIL]
An error occurred that makes the resource manager unavailable. |
-6 | [XAER_PROTO]
xa_commit() was not successful. Function was called in an improper context. |
-5 | [XAER_INVAL]
xa_commit() was not successful. Incorrect arguments were specified. |
-4 | [XAER_NOTA]
The specified xid is not known by the resource manager. |
-3 | [XAER_RMERR]
xa_commit() was not successful. The resource manager detected an error when committing the transaction branch. |
-2 | [XAER_ASYNC]
xa_commit() was not successful. The resource manager does not support asynchronous operations. |
0 | [XA_OK]
xa_commit() was successful. |
4 | [XA_RETRY]
The resource manager is unable to commit the transaction branch at this time. TMNOWAIT(0x10000000L) was set and a blocking condition exists. All resources held on behalf of *xid remain in a prepared state. The transaction manager should issue xa_commit() again at a later time. |
5 | [XA_HEURMIX]
Work on the transaction branch was partially committed and partially rolled back. |
6 | [XA_HEURRB]
Work on the transaction branch was heuristically rolled back. |
7 | [XA_HEURCOM]
Work on the transaction branch was heuristically committed. |
8 | [XA_HEURHAZ]
Work on the transaction branch may have been heuristically completed. |
Error Messages
The following messages may be sent from this function.
Message ID | Error Message Text |
---|---|
CPE3418 E | Possible APAR condition or hardware failure. |
CPF3CF2 E | Error(s) occurred during running of &1 API. |
CPF9872 E | Program or service program &1 in library &2 ended. Reason code &3. |
Related Information
- X/Open CAE Specification, December 1991, Distributed Transaction
Processing: The XA Specification (ISBN:1-872630-24-3, C193 or XO/CAE/91/300),
The Open Group.
- X/Open CAE Specification, April 1995, Distributed Transaction Processing: The TX (Transaction Demarcation) Specification (ISBN:1-85912-094-6, C504), The Open Group.
Example
Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.
#include <xa.h> main() { XID *xid; int rmid; long flags; int retcode; extern struct xa_switch_t xa_switch; retcode = xa_switch.xa_commit_entry(xid, rmid, flags); }
API introduced: V5R2