OpenTP1 Version 7 Programming Reference C Language

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

dc_trn_begin - Start a transaction

Format

ANSI C, C++

#include <dctrn.h>
int  dc_trn_begin (void)

K&R C

#include <dctrn.h>
int dc_trn_begin()

Description

The function dc_trn_begin() starts a global transaction from the process that calls this function. The process that called the function dc_trn_begin() becomes the root transaction branch of the global transaction.

For the UAP which calls the function dc_trn_begin(), specify the transaction attribute at execution environment setup.

Once the function dc_trn_begin() is called in a global transaction, the function dc_trn_begin() cannot be recalled from any transaction branch of the global transaction. If the function dc_trn_begin() is called more than once in a global transaction, an error is returned.

Return values

Return value Return value (numeric) Explanation
DC_OK 0 Normal termination. A global transaction was generated, and the process that called the function dc_trn_begin() is in the range of the global transaction.
DCTRNER_PROTO -905 The function dc_trn_begin() was called 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.
DCTRNER_RM -906 A resource manager (RM) error occurred. A transaction could not be started.
DCTRNER_TM -907 A transaction could not be started because a transaction service error occurred. The value specified for the trn_tran_process_count operand in the transaction service definition may be insufficient.
If this value is returned, reexecute processing. The reexecution is very likely to be successful.

Example

if(!dc_trn_info(NULL) &&dc_trn_begin() <0)
   fputs("cannot begin transaction\n", stderr);