Skip to content

COMMIT

Make Database Changes Permanent

This directive terminates a TRANSACTION BEGIN directive. All records that were changed in between the TRANSACTION BEGIN and the COMMIT directive become permanent records.

COMMIT [,ERR=line-ref|,ERC=error-code]
line-ref
is the program line number or label to branch to if an error is produced by this function.
error-code
is a programmer-defined error code. Valid values are positive or negative whole numbers.

All I/O changes that were made to the various files become permanent.

On an error branch, you cannot retry the COMMIT directive. The error branch is taken when something unusual has happened, such as a system error.

All record locks that were a part of the transaction process are released.

00010 TRANSACTION BEGIN
00020 CH1=UNT; OPEN(CH1) "MSORTFILE"
00030 CH2=UNT; OPEN(CH2) "DIRECTFILE"
00040 CLEAR ERC;
K$ = KEY(CH1);
READ RECORD(CH1) A$;
WRITE RECORD (CH2,KEY=K$,ERC=99) A$;
REMOVE(CH1,KEY=K$,ERC=99);
IF ERC
ROLLBACK
ELSE
COMMIT
FI

LOG CLOSE, LOG OPEN, ROLLBACK, and TRANSACTION BEGIN directives

From the Thoroughbred Basic Language Reference, Volume I: A–E, version 8.9.1. Open this page in the PDF