User Tools

Site Tools

Navigation:  Language Reference > 13 - Built-in Functions >====== ROLLBACK (terminate unsuccessful transaction) ====== Previous pageReturn to chapter overviewNext page



The ROLLBACK statement terminates an active transaction. Execution of a ROLLBACK statement assumes that the transaction was unsuccessful and the database must be restored to the state it was in before the transaction began.

ROLLBACK informs the file driver involved in the transaction that the temporary files containing the information necessary to restore the database to its previous state must be used to restore the database. The file driver then performs the actions necessary to its file system to roll back the transaction.

Errors Posted:

65 Unable to ROLLBACK Transaction
91 No Logout Active


LOGOUT(1,OrderHeader,OrderDetail)     !Begin Transaction

DO ErrHandler                         !always check for errors

ADD(OrderHeader)                      !Add Parent record

DO ErrHandler                         !always check for errors

LOOP X# = 1 TO RECORDS(DetailQue)     !Process stored detail records

 GET(DetailQue,X#)                    !Get one from the QUEUE

 DO ErrHandler                        !always check for errors

 Det:Record = DetailQue               !Assign to record buffer

 ADD(OrderDetail)                     !and add it to the file

 DO ErrHandler                        !always check for errors


COMMIT                                !Terminate successful transaction


ErrHandler ROUTINE                     !Error routine

IF NOT ERRORCODE() THEN EXIT.         !Bail out if no error

ROLLBACK                              !Rollback the aborted transaction


BEEP                                  !Alert the user

MESSAGE('Transaction Error - ' & ERROR())

RETURN                                !and get out

See Also:



rollback_terminate_unsuccessful_transaction_.htm.txt · Last modified: 2021/04/15 15:57 by