TRANSACTION

This directive provides OpenESQL with specifications for managing run-time transactions and, in some cases, enabling compile-time checking.

Syntax:

TRANSACTION={GLOBAL | LOCAL | MIXED | AUTO}

Parameters:

GLOBAL Manages transactions via a distributed transaction manager, such as CICS or a Java application server, and its external SQL connection.

Checks for the following statements that are not compatible with CICS or Java application server applications:

  • BEGIN TRANSACTION
  • COMMIT
  • CONNECT
  • DISCONNECT
  • ROLLBACK
  • SET AUTOCOMMIT
  • SET CONNECT
  • SET TRANSACTION [ISOLATION]

Reports an error for each incompatible statement found.

LOCAL Manages transactions via a data source and its OpenESQL connection.
When BEHAVIOR=JCL, the default behavior includes:
  • Checks for the following statements that are not compatible with JCL applications:
    • CONNECT
    • DISCONNECT
    • SET CONNECT
  • Reports an error for each incompatible statement found.
MIXED Manages transactions via a distributed transaction manager (similar to GLOBAL), but does not perform compile-time checking. This allows EXEC SQL CONNECT statements to create local transactions with an OpenESQL connection in addition to the connection provided by the distributed transaction manager.
AUTO

Use this option when you want to AUTOCOMMIT each statement executed on an OpenESQL connection:

  • An application can programmatically control the autocommit setting for a connection by executing the EXEC SQL SET AUTOCOMMIT statement
  • An application in autocommit mode can start a local database transaction with the EXEC SQL BEGIN TRANSACTION statement. The transaction ends when the next COMMIT or ROLLBACK statement is executed
  • When a transaction ends, if the connection's autocommit attribute is on, the connection reverts to autocommit mode; otherwise a new local database transaction is started automatically.

Properties:

Default: TRANSACTION=LOCAL

Scope:

Used at compile time: Yes
Behavior at run time: N/A

See Scope - OpenESQL SQL Compiler Directive Options for more information.