OpenTP1 Version 7 Programming Reference COBOL Language

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

CBLDCTRN('C-COMMIT') - Enable commitment in chained 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 'C-COMMIT'.
    02  data-name-B    PIC X(5).

Description

CBLDCTRN('C-COMMIT') acquires the synchronization point of a transaction. The normal termination of processing (commitment) is reported from the root transaction branch to the UAPs, transaction services, and resource managers of transaction branches which form the transaction.

When CBLDCTRN('C-COMMIT') terminates normally, a new global transaction is started. The process that called CBLDCTRN('C-COMMIT') is in the range of this transaction. However, this does not mean the specification of a transaction mode for a UAP other than the UAP that called CBLDCTRN('C-COMMIT').

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

CBLDCTRN('C-COMMIT') can be called only from the root transaction branch (the UAP that started the transaction. If CBLDCTRN('C-COMMIT') is called from another UAP, the status code 00905 is returned.

Only the process that started the UAP created correctly according to the specification in this manual is permitted to call CBLDCTRN('C-COMMIT').

CBLDCTRN('C-COMMIT') returns with normal or abnormal termination when synchronization point processing is completed. To terminate the service that called CBLDCTRN('C-COMMIT') normally, the transaction attribute must be set in the UAP execution environment.

Data area whose value is set in the UAP

data-name-A

Specify VALUE 'C-COMMIT' for the request code indicating transaction commit in chained mode. The contents remain unchanged for processing after the chained mode commit 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. Even after CBLDCTRN('C-COMMIT') terminates, this process is under the transaction and it is in the range of the global transaction.
00902 The current transaction was rolled back because it could not be committed. After the completion of processing, this process is under the transaction and it is in the range of the global transaction.
00903 The global transaction that called CBLDCTRN('C-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.
Even after this code is returned, this process is under the transaction and it is 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.
Even after this code is returned, this process is under the transaction and it is 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('C-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.
00924 The commitment processing terminated normally, but the new transaction could not be started. After this code is returned, this process is no longer under the transaction.
00925 The transaction to be committed was rolled back because it could not be committed. The new transaction could not be started. After this code is returned, this process is no longer under transaction.
00926 The global transaction that called CBLDCTRN('C-COMMIT') was determined heuristically. Consequently, a transaction branch was committed, and another transaction branch was rolled back. This error is returned if the result of heuristic decision do not match the results of the synchronization point of the global transaction. Refer to the contents of 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. The new transaction could not be started. After this code is returned, this process is no longer under transaction.
00927 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 contents of 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.
The new transaction could not be started. After this code is returned, this process is no longer under transaction.
This function returns the status code 00927 even when you specify 00000001 for the trn_extend_function operand in the transaction service definition and the return value from the resource manager is XAER_NOTA.

Example

01 MISC.
    02  CMD-CODE      PIC X(8).
    02  STATUS-CODE   PIC X(5).
      :
      :
MOVE 'C-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.