OpenTP1 Version 7 Programming Reference C Language

[Contents][Index][Back][Next]

dc_trn_unchained_commit - Enable commitment in unchained mode

Format

ANSI C, C++

#include <dctrn.h>
int  dc_trn_unchained_commit (void)

K&R C

#include <dctrn.h>
int  dc_trn_unchained_commit()

Description

The function dc_trn_unchained_commit() posts the normal termination of a global transaction (commitment) to the UAPs, transaction services, and resource managers of transaction branches which form the transaction. After the function dc_trn_unchained_commit() terminates normally, a new global transaction is not started.

When a global transaction consists of multiple transaction branches (not only with the UAP that called the function), commitment processing is executed only when the processing results of each transaction branch is committed.

The function dc_trn_unchained_commit() can be called only from the root transaction branch (the UAP that started the transaction). If the function is called from any other transaction, it returns with an error, giving the return value DCTRNER_PROTO.

Only the process that started the UAP which is created correctly according to the specification in this manual is permitted to call the function dc_trn_unchained_commit().

The function dc_trn_unchained_commit() can terminate either normally or abnormally when synchronization point processing is completed. To have the service which calls the function dc_trn_unchained_commit() terminated normally, specify the transaction attribute at UAP execution environment setup.

Return values

Return value Return value (numeric) Explanation
DC_OK 0 Normal termination. This process is not under the transaction and it is not in the range of the global transaction.
DCTRNER_ROLLBACK -902 The current transaction was rolled back because it could not be committed. This process is not in the range of the global transaction.
DCTRNER_HEURISTIC -903 The global transaction that called the function dc_trn_unchained_commit() was determined heuristically. Consequently, a transaction branch was committed, and another transaction branch was rolled back.
This value is returned if the results of heuristic decision do not match the results of the synchronization point of the global transaction.
Refer to the message log file for the results of the synchronization point of the UAP, resource manager, or global transaction that caused this value to be returned.
After this value is returned, this process is not under the transaction and it is not in the range of the global transaction.
DCTRNER_HAZARD -904 A transaction branch of the global transaction was completed heuristically. However, the results of the synchronization point of the heuristically completed transaction branch are not known due to an error.
Refer to the message log file for the results of the synchronization point of the UAP, resource manager, or global transaction that caused this value to be returned.
After this value is returned, this process is not under the transaction and it is not in the range of the global transaction.
This function returns DCTRNER_HAZARD even when you specify 00000001 for the trn_extend_function operand in the transaction service definition and the return value from the resource manager at one-phase commit is XAER_NOTA.
DCTRNER_PROTO -905 The function dc_trn_unchained_commit() was called from an invalid context (e.g., already not in the transaction). The transaction mode is not affected.

Example

if(dc_trn_info(NULL) &&dc_trn_unchained_commit() <0)
  fputs("cannot commit transaction\n", stderr);