ROLLBACK
Cancel Database Changes
This directive terminates a TRANSACTION BEGIN directive. All records that were changed in between the TRANSACTION BEGIN and the ROLLBACK directive are replaced with the original records.
Syntax
Section titled “Syntax”ROLLBACK [,ERR=line-ref|,ERC=error-code]line-ref- is the program line number or label to branch to if this directive produces an error.
error-code- is a programmer-defined error code. Valid values are positive or negative whole numbers.
Remarks
Section titled “Remarks”All record locks that were a part of the transaction process are released.
On an error branch, you cannot retry this ROLLBACK directive. The error branch is taken when something unusual has happened, such as a system error.
On an error, all records that did not give an error are ROLLed BACK.
Directives that close all channels, such as BEGIN, END, CLOSE(0) and RELEASE, automatically execute a ROLLBACK if a TRANSACTION BEGIN is active, followed by a LOG CLOSE.
Examples
Section titled “Examples”00010 TRANSACTION BEGIN00020 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 FISee also
Section titled “See also”COMMIT, LOG CLOSE, LOG OPEN, and TRANSACTION BEGIN directives
From the Thoroughbred Basic Language Reference, Volume III: R–Z, version 8.9.1. Open this page in the PDF