RSC/MP 7.2 Programming Manual

Application Development
HP NonStop Remote Server Call (RSC/MP) Programming Manual522360-004
6-11
Detecting Failed Transactions
6. Set the SUCCESS_LO and SUCCESS_HI options to the desired values. These
values establish the range of server reply codes that indicates successful
completion.
7. Issue an RscWriteRead call to send the final message in the transaction to the
host.
8. Examine the return code from the RscWriteRead call.
Ending Automatic Transactions
If the first word (two bytes) of the server reply code is within the range defined by the
SUCCESS_LO and SUCCESS_HI options, the TDP automatically ends the
transaction, and no changes are made to the database when the transaction is
committed. Note that the value of the server reply code is treated as a signed integer.
The workstation receives the reply code in the byte order dictated by the NonStop
server. RSC/MP does not modify the byte order of the reply code in the message buffer
returned to the workstation session.
If the server reply code is outside the defined range, the TDP leaves the transaction
active and completes the RscWriteRead call (for waited I/O) or RscIoCheck call (for
nowaited I/O) with return code 28 (RSC_TRANSACTION_NOT_ENDED). The client
application must then explicitly end or abort the transaction by issuing an
RscEndTransaction or RscAbortTransaction function call.
Detecting Failed Transactions
A client application might not be able to detect whether its transaction was ended or
aborted. This could happen if a connection or session error occurs during an
RscEndTransaction, RscWriteRead, or RscIoCheck operation while a transaction is
being ended or aborted. For example, suppose that:
The client already has a transaction in progress, has set the TMF_OPTION
(RSC_END_TRANS), and issued an RscWriteRead call (waited I/O).
The RscWriteRead call completes with a return code indicating that the
communications connection to the host was terminated.
In these circumstances, the client application cannot differentiate between these
possibilities:
The error occurred before the TDP received the request. The TDP aborted the
transaction because the client was disconnected.
The error occurred after the TDP ended the transaction and was replying to the
client. The transaction was already committed.
To detect a connection failure, the client can use the RscErrorInfo function to determine
the error class returned by the RscEndTransaction, RscWriteRead, and RscIoCheck
functions. If the error class is RSC_CONNECT_FATAL or RSC_SESSION_FATAL, the
client cannot determine whether the transaction was ended or aborted. At this point,