Product Documentation

FairCom RTG COBOL User Guide

Previous Topic

Next Topic

<transaction>

The transaction option indicates whether or not to create files with transaction support enabled. This feature is turned on by default.

The <transaction fileops="yes"> setting instructs FairCom RTG that file operations are under transaction processing control. Basically, it means that if you perform a file operation (file create, rename, delete) while a transaction is active, the result of such operation is affected by the transaction result.

For example, consider the following set of operations:

Open fileA

Begin Transaction

Update Record1 on FileA

Create fileB

Abort Transaction

  • If fileops is turned on, fileB will be automatically removed when the transaction is aborted. If fileops is turned off (default) the file will always be created regardless of the transaction result.
  • If fileops is turned on and a file creation is attempted outside a transaction scope, FairCom RTG starts and commits a transaction automatically to allow for the file creation to complete.

Please note that it is possible to enable/disable transaction support and transaction logging on existing files using the -tron option of the ctutil utility.

Accepted Values

Value

Effect

Synonyms

yes

Turns on transaction support. This is the default value.

y, true, on, 1

no

Turns off transaction support.

n, false, off, 0

Attributes

Attribute

Description

Default Value

logging

Enable/disable transaction logging.

Values:

"yes" : Turns on transaction logging. It is indicated when data safety is more important than performance. Files are created with c-tree file mode ctTRNLOG and are automatically recovered after a crash.

"no" : Turns off transaction logging. It is indicated when performance is more important than data safety. Files are created with c-tree file mode ctPREIMG. This is the default value.

"no"

fileoperations (or fileops)

Determines whether file operations (such as file create, delete, and rename) performed within an active transaction are affected by the transaction ending operation (commit or abort):

"yes" : File operations are transaction dependent.

"no" : File operations performed within an active transaction are not affected by the transaction ending operation (commit or abort).

"no"

deferautocommit

Turn on optimization that improves performance for functions that use autocommit. Similar to the c-tree DELAYED_DURABILITY keyword, guarantees atomicity and consistency of transaction but not durability because the last transaction could be lost.

"no"

Examples

Example 1: To turn off transaction logging:

<transaction logging="no">yes</transaction>

Example 2: The following pseudo-code creates a file if <transaction fileops="no"> and does not create a file if <transaction fileops="yes">:

begin

create file

rollback

Example 3: To enable autocommit optimization:

<transaction deferautocommit="yes">

TOCIndex