OpenTP1 Version 7 Programming Reference COBOL Language

[Contents][Index][Back][Next]

CBLDCTRN('U-COMMIT') - Enable commitment in unchained mode

Format

PROCEDURE DIVISION specification

CALL  'CBLDCTRN'  USING  unique-name-1

DATA DIVISION specification

01  unique-name-1.
    02  data-name-A    PIC X(8) VALUE 'U-COMMIT'.
    02  data-name-B    PIC X(5).

Description

CBLDCTRN('U-COMMIT') reports the normal termination of a global transaction (commitment) to the UAPs, transaction services, and resource managers of transaction branches which form the transaction. After CBLDCTRN('U-COMMIT') terminates normally, a new global transaction is not generated.

When a global transaction consists of multiple transaction branches (not only with the UAP that called CBLDCTRN('U-COMMIT')), commitment processing is executed only when the processing results of each transaction branch is committed.

The CBLDCTRN('U-COMMIT') can be called only from the root transaction branch (the UAP that called CBLDCTRN('U-COMMIT')) of a global transaction. If CBLDCTRN('U-COMMIT') is called from another UAP, the status code 00905 is returned.

Only the process that started the UAP executable file correctly linked according to the specification in this manual is permitted to call CBLDCTRN('U-COMMIT').

CBLDCTRN('U-COMMIT') returns with normal or abnormal termination when synchronization point processing is completed. To terminate CBLDCTRN('U-COMMIT') normally, specify the transaction attribute at UAP execution environment setup.

Data area whose value is set in the UAP

data-name-A

Specify VALUE 'U-COMMIT' for the request code indicating transaction commit in unchained mode. The contents remain unchanged for processing after the unchained mode commit statement is executed.

Data area whose value is returned from OpenTP1

data-name-B

A status code of 5 digits is returned.

Status codes

Status code Explanation
00000 Normal termination. This process is not under the transaction and it is not in the range of the global transaction.
00902 The current transaction was rolled back because it could not be committed. This process is not in the range of the global transaction.
00903 The global transaction that called CBLDCTRN('U-COMMIT') was determined heuristically. Consequently, a transaction branch was committed, and another transaction branch was rolled back.
This code is returned if the results of heuristic decision do not match the results of the synchronization point of the global transaction.
Refer to the message log file for the results of the synchronization point of the UAP, resource manager, or global transaction that caused this code to be returned.
After this code is returned, this process is not under the transaction and it is not in the range of the global transaction.
00904 A transaction branch of the global transaction was completed heuristically. However, the results of the synchronization point of the heuristically completed transaction branch are not known due to an error.
Refer to the message log file for the results of the synchronization point of the UAP, resource manager, or global transaction that caused this code to be returned.
After this code is returned, this process is not under the transaction and it is not in the range of the global transaction.
This function returns the status code 00904 even when you specify 00000001 for the trn_extend_function operand in the transaction service definition and the return value from the resource manager at one-phase commit is XAER_NOTA.
00905 CBLDCTRN('U-COMMIT') was called from an invalid context (e.g., already not in the transaction). The transaction mode is not affected.
00908 The request code is invalid.

Example

01 MISC.
    02  CMD-CODE      PIC X(8).
    02  STATUS-CODE   PIC X(5).
       :
       :
MOVE 'U-COMMIT' TO CMD-CODE OF MISC.
CALL 'CBLDCTRN' USING MISC.
IF STATUS-CODE OF MISC NOT EQUAL TO '00000' THEN
    MOVE 'CANNOT COMMIT TRANSACTION' TO ERRMSG OF
                                         OUT-ERROR-REC
    WRITE OUT-ERROR-REC
END IF.