gtpc2m90C/C++ Language Support User's Guide

tx_rollback-Roll Back a Global Transaction

This function rolls back the work of the transaction activated by the entry control block (ECB) of the caller.

Format

#include   <tpfapi.h>
int         tx_rollback();

Normal Return

Table 30. tx_rollback Normal Return

Value Name Return Code Description
TX_OK 0 The function is completed successfully.

Error Return

Table 31. tx_rollback Error Return

Value Name Return Code Description
TX_PROTOCOL_ERROR -5 The function was called incorrectly.

Programming Considerations

Examples

The following example shows how the tx_rollback function is used to roll back a nested transaction and then the root transaction.

#include   <tpfapi.h>
         tx_begin();                 /* begin a root transaction      */
              .
              .                      /* all RM native API calls will  */
              .                      /* be associated with the root   */
              .                      /* transaction                   */
              .
            tx_begin();              /* begin a nested transaction    */
              .
              .                      /* all RM native API calls will  */
              .                      /* be associated with the nested */
              .                      /* transaction                   */
              .
            tx_rollback();           /* rollback nested transaction   */
              .
         tx_rollback();              /* rollback root transaction     */

Related Information