Purpose
TRANSACT specifies the transaction protocol that the application program (compile unit) uses.
Usage Notes
TRANSACT(COMMIT) is the default.
The following table explains the transaction modes.
Mode | Description |
---|---|
ANSI | ANSI transaction semantics are enabled. Selecting this option causes C language strings to be padded with blanks (rather than with nulls) by default. For all languages, truncation of any nonblank and nonzero character produces a warning SQLCODE and SQLSTATE. When this option is specified, the following modes are disabled:
|
COMMIT | Execution of a Teradata SQL request when no transaction (unit of work) is active causes a transaction to be initiated. This is the default. The transaction that is initiated is not terminated until the application terminates or executes one of these statements:
If the transaction is active and the application terminates without an explicit COMMIT or LOGOFF statement while executing in COMMIT mode, the database rolls back all uncommitted work. This is a distinct difference between DB2 and the database. When this option is specified, the following modes are disabled:
|
BTET | Execution of a Teradata SQL request when no transaction is active causes that request to execute as an implicit transaction, even if the request consists of a single Teradata SQL statement. When this option is specified, the following modes are disabled:
Initiate and terminate transactions spanning more than one request using BEGIN TRANSACTION and END TRANSACTION. This is a distinct difference between DB2 and the database. |
2PC | The program uses the two phase commit protocol. In 2PC mode, an external resource manager (CICS, IMS, or one written by the user) controls transaction initiation and termination. When this option is specified, the following modes are disabled:
Only available for mainframe-attached clients. An ABORT, BT, CHECKPOINT, COMMIT, DATABASE, ET, ROLLBACK or DDL statement causes an error if 2PC mode is specified. The ABORT, CHECKPOINT, DATABASE, ROLLBACK and DDL statements are valid with BTET or COMMIT transaction protocols, but are disallowed with the 2PC protocol. This is a distinct difference between DB2 and the database. |
TRANSACT(2PC) is valid only for mainframe-attached applications.
PP2 issues a diagnostic if a BEGIN TRANSACTION or END TRANSACTION statement is found in a program precompiled with the TRANSACT(ANSI), TRANSACT(COMMIT) or TRANSACT(2PC) option; or if a COMMIT statement is found in a program precompiled with the TRANSACT(BTET) or TRANSACT(2PC) option.
The transaction protocol for the compile unit where the session is established remains in effect until the session is terminated, regardless of additional compile units with different modes that might be invoked during the session.