ax_reg()--Exit Program to Dynamically Register an XA Resource Manager (Job Scoped Locks)
Syntax
#include <xa.h> int ax_reg(int rmid, XID *xid, long flags);
Threadsafe: Conditional; see Usage Notes.
The XA resource manager calls ax_reg() to inform a transaction manager that it is about to do work on behalf of an application in a thread of control. The transaction manager needs to tell the resource manager whether or not that work should be performed on behalf of a transaction branch. If the work is part of a transaction branch, the transaction manager will return the transaction branch identifier in *xid. If the work is not part of a transaction branch, the transaction manager will return the NULLXID in *xid.
The XA resource manager indicates that it uses dynamic registration by setting the TMREGISTER value in the flags element of its xa_switch_t structure.
The name of the service program that contains ax_reg() and ax_unreg() must be provided to the XA resource manager in the *xa_info parameter of the db2xa_open() call.
Parameters
- rmid
- (Input) The resource manager identifier that was generated by a transaction
manager when the resource manager was opened.
- *xid
- (Input) A pointer to the buffer where the transaction manager will store the generated transaction branch identifier. This identifier is associated with work done in the calling thread of control or with a NULLXID, which indicates that work is being done outside a transaction branch.
- flags
- (Input) The flags argument must be set to this value. TMNOFLAGS: 0x00000000L No flags are defined for this function.
Authorities
None
Return Value
| -3 | [TMER_PROTO]
ax_reg() was not successful. Function was called in an improper context. |
| -2 | [TMER_INVAL]
ax_reg() was not successful. Incorrect arguments were specified. |
| -1 | [TMER_TMERR]
ax_reg() was not successful. The transaction manager detected an error when registering the resource. |
| 0 | [TM_OK]
ax_reg() was successful. |
| 1 | [TM_RESUME]
The resource manager should resume work on a previously suspended transaction branch. If the resource manager does not recognize the *xid, it will return a failure indication to the application. |
| 2 | [TM_JOIN]
The resource manager is joining the work of an existing transaction branch. If the resource manager does not recognize the *xid, it will return a failure indication to the application. |
Usage Notes
- This function must be threadsafe if the transaction manager calls the XA APIs in a multithreaded job.
- Refer to Restrictions in the introduction to the XA APIs for restrictions when using the TM_JOIN return value.
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.
Exit program introduced: V4R3