OpenTP1 Version 7 Programming Reference COBOL Language

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

CBLDCTRN('BEGIN ') - Start a transaction

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 'BEGIN   '.
    02  data-name-B    PIC X(5).

Description

CBLDCTRN('BEGIN ') starts a global transaction from the process that calls the program. CBLDCTRN('BEGIN ') that started the transaction becomes the root transaction branch of the global transaction.

For the UAP that starts the transaction, specify transaction attribute. Once the transaction is started in a global transaction, the transaction cannot be restarted from any transaction branch of the global transaction. If the transaction is started more than once in a global transaction, an error is returned.

Data area whose value is set in the UAP

data-name-A

Specify VALUE 'BEGIN[Figure]' for the request code indicating transaction start. The contents remain unchanged for processing after the transaction starts.

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. A global transaction was generated, and the process that called CBLDCTRN('BEGIN ') is in the range of the global transaction.
00905 A service was requested to the service program from an invalid context (e.g., already in the transaction). Alternatively, the transaction could not be started because the execution environment was in non-journal operation mode.
00906 A resource manager (RM) error occurred. A transaction could not be generated.
00907 A transaction could not be generated because a transaction service error occurred. The value assigned to the trn_tran_process_count operand in the transaction service definition may be too small. If this code is returned, re-execute processing. The re-execution is very likely to be successful.
00908 The request code is invalid.

Example

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