TPSUSPEND
-suspend a global transaction
01TPTRXDEF-REC
.
COPY TPTRXDEF.
01TPSTATUS-REC
.
COPY TPSTATUS.
CALL "TPSUSPEND" USINGTPTRXDEF-REC TPSTATUS-REC
.
TPSUSPEND
is used to suspend the transaction active in the caller's program. A transaction begun with TPBEGIN
() may be suspended with TPSUSPEND
. Either the suspending program or another program may use TPRESUME
() to resume work on a suspended transaction. When TPSUSPEND
returns, the caller is no longer in transaction mode. However, while a transaction is suspended, all resources associated with that transaction (such as database locks) remain active. Like an active transaction, a suspended transaction is susceptible to the transaction timeout value that was assigned when the transaction first began.
For the transaction to be resumed in another process, the caller of TPSUSPEND
must have been the initiator of the transaction by explicitly calling TPBEGIN
. TPSUSPEND
may also be called by a process other than the originator of the transaction (for example, a server that receives a request in transaction mode). In the latter case, only the caller of TPSUSPEND
may call TPRESUME
to resume that transaction. This case is allowed so that a process can temporarily suspend a transaction to begin and do some work in another transaction before completing the original transaction (for example, to run a transaction to log a failure before rolling back the original transaction).
TPSUSPEND
populates TRANID
with the transaction identifier being suspended.
To ensure success, the caller must have completed all outstanding transactional communication with servers before issuing TPSUSPEND
. That is, the caller must have received all replies for requests sent with TPACALL
() that were associated with the caller's transaction. Also, the caller must have closed all connections with conversational services associated with the caller's transaction (that is, TPRECV
() must have returned the TPEV-SVCSUCC event). If either rule is not followed, then TPSUSPEND
fails, the caller's current transaction is not suspended and all transactional communication handles remain valid. Communication handles not associated with the caller's transaction remain valid regardless of the outcome of TPSUSPEND
.
Upon successful completion, TPSUSPEND
sets [TPOK]
.
Under the following conditions, TPSUSPEND
fails and sets TP-STATUS
to:
TPEABORT
]
TPEPROTO
]
TPSUSPEND
was called in an improper context (for example, the caller is not in transaction mode). The caller's state with respect to transaction mode is unchanged.
TPESYSTEM
]
TPEOS
]
TPACALL
(), TPBEGIN
(), TPRECV
(), TPRESUME
().