The xa_prepare() function

The xa_prepare() function prepares XA data source transaction changes for a commit or rollback operation. A successful return from xa_prepare() indicates that the XA data source will successfully commit or rollback when requested.

The syntax for the function is:
mint xa_prepare (XID *xid,    /* IN */
          mint rmid,     /* IN */
          int4 flags)   /* IN */
Table 1. The xa_prepare() parameters
Parameter Description
xid Pointer to the XID data structure that is defined in the xa.h file and used for the current transaction
rmid Unique resource manager identifier
flags TMNOFLAGS, which is the valid value.
The following code fragment contains the xa_prepare() function:
#include "xa.h"
mint mqseries_prepare(XID *xid, mint rmid, int4 flags)
  {
/*  Error  */
   return XAER_RMERR;
/* Success */
  return XA_OK;
}

For valid return values, refer to X/Open information, including Distributed Transaction Processing: The XA Specification.