Specifying the ABL transaction (4GLTrans) log entry type turns on logging of transactions and subtransactions in ABL procedures. ABL transaction logging logs a message whenever a transaction or subtransaction begins or ends, or when a transaction is undone. Logging ABL transaction activity is useful in identifying transaction processing or scoping errors in your application.
The 4GLTrans log entry type provides information at the following logging levels:
Level 2 (Basic) — Logs messages when a transaction begins or ends, or when a transaction is undone
Level 3 (Verbose) — Logs messages when a transaction or subtransaction begins or ends, or when a transaction or subtransaction is undone
The format for ABL transaction log messages is:
Syntax
{ BEGIN | END | UNDO }[ SUB-]TRANS trans-id[proc-name @ line-number]
BEGIN
Indicates the beginning of a transaction or subtransaction block.
END
Indicates the end of a transaction or subtransaction block, where any changes made during the transaction or subtransaction were committed.
UNDO
Indicates the end of a transaction or subtransaction block, where any changes made during the transaction or subtransaction were undone (rolled back).
SUB-TRANS
Indicates the log entry is for a subtransaction (occurring within the scope of the currently active transaction).
TRANS
Indicates the log entry is for a transaction.
trans-id
A unique transaction identifier, which lets you locate the matching BEGIN and END messages for a single transaction or subtransaction block within a log file.
proc-name
The name of the procedure in which the transaction or subtransaction occurred.
@ line-number
The line number (in the debug listing for the procedure specified in proc-name) at which the transaction began or ended.
The following procedure and log file output excerpts demonstrate transaction logging:
/* trantest.p */
DEFINE VARIABLE iVar AS INTEGER NO-UNDO.
DEFINE VARIABLE i1 AS INTEGER NO-UNDO.
DEFINE VARIABLE i2 AS INTEGER NO-UNDO.
DO TRANSACTION ON STOP UNDO, LEAVE:
iVar = 1.
DO TRANSACTION ON STOP UNDO, LEAVE:
DO i1 = 1 TO 10:
i2 = i2 + i1.
END.
iVar = 2.
STOP.
END.
END.
MESSAGE ivar VIEW-AS ALERT-BOX INFO BUTTONS OK.
QUIT.
The preceding procedure generates the following log file output for transaction logging at level 2 (Basic):
BEGIN TRANS 702 [trantest.p @ 6]
END TRANS 702 [trantest.p @ 15]
And the following log file output for transaction logging at level 3 (Verbose):
BEGIN TRANS 702 [trantest.p @ 6]
BEGIN SUB-TRANS 703 [trantest.p @ 8]
UNDO SUB-TRANS 703 [trantest.p @ 14]
END TRANS 702 [trantest.p @ 15]
For more information about the processing of transactions and subtransactions, see the chapter on transactions in OpenEdge Getting Started: ABL Essentials.