TRANSTART Statement

Marks the start of a transaction, preceding any READ/WRITE operations on the database included in the transaction.

Syntax

TRANSTART {transaction-information} {SETTING setting-var} [THEN statement(s) ELSE statement(s)]

Syntax Elements

transaction-information
Optional text, specified as text within double quotes or a variable, to be saved in the transaction-start record. It can be used to identify a particular transaction or iteration of a repetitive transaction. You can only use transaction-information if Transaction Logging is installed and enabled, when it can be used when listing a clean log or during a TL-RESTORE. It is not used in Transaction Handling.

setting-var A variable that is set to a value corresponding to an error code if the ELSE clause is taken, which occurs when transactions have been disabled or the process is already inside a transaction.

statement(s) Either a THEN or an ELSE clause (or both). A statement must be included. The THEN clause is executed if the Transaction Start is successful. The ELSE clause is executed if the transaction start fails.

Operation

If no transaction-information parameter is supplied then the file-name and item-id containing the program performing the transaction along with the time and date is substituted. More than one transaction can occur within a single DataBasic program. A single transaction can span several CHAINed programs. Transactions cannot be nested. A TRANSTART statement followed by another TRANSTART statement without an intervening TRANSEND or TRANSABORT statement causes a run-time error. The ELSE clause in the second TRANSTART statement is then executed. Error codes returned to setting-var can be:

     0          No error (THEN clause executed)
1151          Transaction processing not configured
1155          Currently within a transaction
1167          Transaction processing not in progress

Item Locks

Item locks released within a transaction are held until the transaction is committed or aborted.

Go to top button