OpenTP1 Version 7 Programming Reference C Language

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

dc_trn_chained_commit - Enable commitment in chained mode

Format

ANSI C, C++

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

K&R C

#include <dctrn.h>
int  dc_trn_chained_commit()

Description

The function dc_trn_chained_commit() acquires the synchronization point of a transaction. The normal termination of processing (commitment) is reported as the root transaction branch of the global transaction to the UAPs, transaction services, and resource managers of transaction branches which form the transaction.

When the function dc_trn_chained_commit() terminates normally, a new global transaction is started. The process that calls the function is in the range of this transaction. However, this does not mean the specification of a transaction mode for a UAP other than the UAP that called this function.

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 are committed.

The function dc_trn_chained_commit() can be called only from the root transaction branch (the UAP that called the function dc_trn_begin()) of a global transaction. If the function dc_trn_chained_commit() is called from another UAP, DCTRNER_PROTO is returned.

Only the process that started the UAP executable file correctly linked according to the specification in this manual is permitted to call the function dc_trn_chained_commit().

The function dc_trn_chained_commit() can terminate either normally or abnormally when synchronization point processing is completed. To have the function dc_trn_chained_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. Even after the function dc_trn_chained_commit() terminates, this process is under the transaction and it is in the range of the global transaction.
DCTRNER_ROLLBACK -902 The current transaction was rolled back because it could not be committed.
Even after this return value was returned, the process is still under the transaction and it is within the range of the global transaction.
DCTRNER_HEURISTIC -903 The global transaction that called the function dc_trn_chained_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.
Even after this value is returned, this process is under the transaction and it is 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.
Even after this value is returned, this process is under the transaction and it is 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_chained_commit() was called from an invalid context (e.g., already not in the transaction). The transaction mode is not affected.
DCTRNER_NO_BEGIN -924 Although the commitment processing terminated normally, the new transaction could not be started. After this value is returned, this process is not under the transaction.
DCTRNER_ROLLBACK_NO_BEGIN -925 The transaction was rolled back because it could not be committed. The new transaction could not be started. After this value is returned, this process is not under the transaction.
DCTRNER_HEURISTIC_NO_BEGIN -926 The global transaction that called the function dc_trn_chained_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.
See 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.
The new transaction could not be started. After this value is returned, this process is not under the transaction.
DCTRNER_HAZARD_NO_BEGIN -927 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. See 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.
The new transaction could not be started. After this value is returned, this process is not under the transaction.
This function returns DCTRNER_HAZARD_NO_BEGIN 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.

Example

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