xa_end()--End Work on an XA Transaction Branch (Transaction Scoped Locks)


  Syntax
 #include <xa.h>

 int xa_switch.xa_end_entry(XID *xid, int rmid,     
     long flags);

  Default Public Authority: *USE

  Service Program: QTNXADTP

  Threadsafe: Yes

A transaction manager calls xa_end() when an application thread of control finishes or needs to suspend work on a transaction branch. When xa_end() successfully returns, the calling thread of control is no longer associated with the transaction branch, but the branch still exists.

If the TMSUSPEND flag is not specified, all SQL cursors used while the thread was associated with this transaction branch are closed. Files left open by a procedure, trigger or function that used legacy file access methods are closed regardless of flag settings.


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) The following are valid settings of flags. One, and only one, of TMSUSPEND, TMSUCCESS, or TMFAIL must be set.

TMSUSPEND: 0x02000000L Suspend a transaction branch on behalf of the calling thread. The transaction manager must resume or end the suspended association in the current thread.

TMSUCCESS: 0x04000000L The portion of work has succeeded.

TMFAIL: 0x20000000L The portion of work has failed.


Authorities

None


Return Value

The following return codes indicate that the resource manager has marked the work performed on this transaction branch as rollback-only.


Other return codes:



Error Messages

The following messages may be sent from this function.



Related Information


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_end_entry(xid, rmid, flags);
}


API introduced: V5R2

[ Back to top | UNIX-Type APIs | APIs by category ]