Nonstop Database, HiRDB Version 9 UAP Development Guide
In OLTP, you cannot code the COMMIT and ROLLBACK statements. When synchronization point setting or transaction rollback occurs in a UAP executing in this environment, you must use an application program interface (API) that conforms to X/Open.
An example using OpenTP1 is explained here. For details about how to create a program by using OpenTP1, see the manual OpenTP1 Version 5 Program Reference C Language and the manual OpenTP1 Version 5 Program Reference COBOL Language.
A remote procedure call (RPC) can be used to implement one transaction among multiple OLTP user server processes. Each process is called a transaction branch, and the totality of these processes is called an OLTP global transaction.
When HiRDB is accessed from an OLTP global transaction, HiRDB cannot be accessed by the multiple transaction branches that make up the global transaction branch.
Sometimes when a resource is to be accessed, a timeout occurs because a lock on the resource was issued by a preceding transaction branch in the global transaction branch, thus causing a succeeding transaction branch to wait until the resource becomes available. Similarly, deadlock can occur between transaction branches.
The chain RPC function can be used in such a situation so that multiple RPCs can be treated as belonging to the same transaction branch.
Code the tx_begin function in the UAP.
Code the tx_commit function in the UAP.
Code the tx_rollback function in the UAP.
DATA DIVISION. *include TX definitions. 01 TX-RETURN_STATUS COPY TXSTATUS. PROCEDURE DIVISION. CALL "TXBEGIN" USING TX-RETURN_STATUS.
DATA DIVISION. *include TX definitions. 01 TX-RETURN_STATUS COPY TXSTATUS. PROCEDURE DIVISION. CALL "TXCOMMIT" USING TX-RETURN_STATUS.
DATA DIVISION. *include TX definitions. 01 TX-RETURN_STATUS COPY TXSTATUS. PROCEDURE DIVISION. CALL "TXROLLBACK" USING TX-RETURN_STATUS.
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.