gtpc2m9wC/C++ Language Support User's Guide

xa_open-Open a Resource Manager

A transaction manager (TM) calls the xa_open() function to initialize a resource manager (RM) and prepare it for use in a distributed transaction processing environment. It must be called before any other XA function calls are made.

The transaction manager will issue an xa_open function to each resource manager that is defined in the TPF system at restart time.

Format

#include (i$tmcr.h)
int     xa_open(char *xa_info, int rmid, long flags);

xa_info
A pointer to a null-terminated character string that contains specific information for the resource manager. The maximum length of this string is 256 bytes (including the null terminator). xa_info may point to an empty string if the resource manager does not require specific information to be available. xa_info must not be a null pointer.

rmid
An integer assigned by the transaction manager that can be used to uniquely identify the called resource manager. The TM passes the rmid on subsequent calls to XA routines to identify the resource manager. This identity remains constant until the TM closes the resource manager.

flags
The only value supported is TMNOFLAGS.

Normal Return

XA_OK
Normal completion.

Error Return

XAER_RMERR
An error occurred when opening the resource.

XAER_INVAL
Incorrect arguments were specified.

Programming Considerations

Examples

#include (i$tmcr.h)
 
    if (xa_open(char *xa_info, int rmid, long flags) != XA_OK)
    {
        /* handle error condition */

  ·
  ·
  ·
} else { /* continue with normal processing */
  ·
  ·
  ·
}

Related Information

xa_end-End Work Performed for a Transaction Branch.