OpenTP1 Version 7 Programming Guide
An MHP always behaves as a transaction during a period from the MHP start (when OpenTP1 receives a message) to the MHP termination. This means that OpenTP1 treats all MHP processing as transactions.#
MHP service functions cannot use a transaction control function (dc_trn_begin() or other synchronization point acquisition function beginning with dc_trn). Also, if a service request is called from an MHP to an SPP, the SPP cannot use the transaction control function. When requesting a service from an MHP to an SPP, verify that the transaction control function has not been called in the SPP.
For MHPs, the user service definition must include the specification of atomic_update=Y indicating that the MHP has the transaction attribute.
During MHP processing, the synchronization point can be acquired as a commitment in chained mode. To acquire the synchronization point, call the function dc_mcf_commit() [CBLDCMCF('COMMIT ')]. When the function dc_mcf_commit() returns, the subsequent MHP process becomes a global transaction.
Suppose that a global transaction beginning with an MHP consists of more than one transaction branch (the MHP calls the SPP with the function dc_rpc_call()). Unless the processing result of each transaction branch brings about a commitment, no commitment comes into effect. If the global transaction is not committed, all transaction branches are rolled back.
Before a message is received, the synchronization point cannot be acquired using the function dc_mcf_commit(). In addition, once the synchronization point is acquired using the function dc_mcf_commit(), the MHP can no longer receive the message.
Message processing for which synchronization point acquisition using the function dc_mcf_commit() is performed is the activation of an asynchronous message and an application. Processing for sending or receiving a synchronous message is not the target of synchronization point acquisition.
The function dc_mcf_commit() can be used only from MHPs for which the nonresponse type (noans type) is specified in the MCF application definition. If the function is called from an MHP of another type, it returns with an error. UAPs other than MHPs cannot call the function dc_mcf_commit().
If an MHP terminates abnormally or rolls back,#1 an error event is generated. The type of the error event depends on whether the function dc_mcf_receive() has received the first segment.
If MHP transaction processing ends up with an error, call the function dc_mcf_rollback() [CBLDCMCF('ROLLBACK')] from the MHP in order to return to the status before the message was received. If the MHP that received the message was rolled back, OpenTP1 decides whether to reschedule the MHP according to the argument specification in the function dc_mcf_rollback().
The figure below shows the relationship between message exchange processing and transactions.
Figure 3-12 Relationship between message exchange processing and transactions
If MHP processing is terminated because the message exchange function returns with an error, the transaction itself might be committed. If the resource manager (RM) has been accessed (DAM, TAM) in the MHP processing, this access processing is committed. To roll back the access processing, call the abort function or create processing for using the function dc_mcf_rollback() after an error is returned.
Even MHPs can use a transaction starting function (dc_trn_begin()) if the function is outside the service function processing range (within the main function processing range). The transaction start function and commitment functions can be called between main functions (e.g., between the dc_rpc_open() and the dc_mcf_mainloop() or between the dc_mcf_mainloop() and the dc_rpc_close()).
If the function dc_trn_begin() is called as an MHP main function, acquire a synchronization point by using the function dc_trn_unchained_commit() (commitment in unchained mode) as an MHP main function.
All Rights Reserved. Copyright (C) 2006, 2010, Hitachi, Ltd.