OpenTP1 Version 7 Programming Guide
To start a transaction by TX_ functions, call the functions from UAP as shown below. To call the functions in this order, the transaction can be started regardless of the atomic_update specification in the user service definition. If atomic_update = Y is specified in the user service definition, transaction processing start can be called unless tx_open() [TXOPEN] and tx_close() [TXCLOSE] are called.
dc_rpc_open() tx_open() tx_begin() : : tx_commit() (synchronization point processing) tx_close() : tx_open( ) and tx_close( ) can be reissued in this section. dc_rpc_close() |
dc_rpc_open() tx_open() dc_rpc_mainloop() : (Service function processing) tx_begin() : : tx_commit() (synchronization point processing) : (Main function dc_rpc_mainloop() returns.) tx_close() : dc_rpc_close() |
When starting a transaction within the service functions of SPP, call tx_open() before the function dc_rpc_mainloop().
Transaction processing started by tx_begin() [TXBEGIN] must always be completed by the function that obtains synchronization point (tx_commit() [TXCOMMIT] or tx_rollback() [TXROLLBACK]).
The chained mode (TX_CHAINED) and unchained mode (TX_UNCHAINED) are provided for tx_commit() and tx_rollback(). When starting a new global transaction after obtaining synchronization point, set the chained mode. When terminating transaction processing without starting a new transaction, set the unchained mode. The chained or unchained mode is set as a transaction_control characteristic by tx_set_transaction_control() [TXSETTRANCTL].
Characteristics of transaction processing can be set by TX_ functions.
When a transaction is committed in two phases, you can set whether control returns upon completion of the first or second phase. With the corresponding version of OpenTP1, return before completion of the second phase cannot be set. If such return is set, control returns with error. commit_return characteristic is set by tx_set_commit_return() [TXSETCOMMITRET].
Sets whether a new transaction is to be started (chained mode or unchained mode) after the synchronization point (tx_commit() or tx_rollback()). For transaction_control characteristic, set either TX_CHAINED or TX_UNCHAINED by tx_set_transaction_control() [TXSETTRANCTL].
Monitoring time for transactions can be set. The transaction_timeout characteristic is set by tx_set_transaction_timeout() [TXSETTIMEOUT]. The transaction_timeout characteristic set by tx_set_transaction_timeout() has priority over the value of trn_expiration_time defined by the system.
tx_info() [TXINFORM] enables the structures containing transaction branch IDs or transaction characteristics to be referenced.
The following shows the formats of the structures that can be referenced.
XID xid; COMMIT_RETURN when_return; TRANSACTION_CONTROL transaction_control; TRANSACTION_TIMEOUT transaction_timeout; TRANSACTION_STATE transaction_state; |
By using tx_open() and tx_close(), processing after tx_begin() can be processed as a transaction, regardless of the value of atomic_update in the user service definition.
When a service is called by the UAP which called tx_begin(), processing of the service is included in the global transaction, regardless of the specification of atomic_update in the server UAP.
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.