SAVEPNT
The SAVEPNT statement allows you to establish a savepoint within a transaction.
••••• SAVEPNT ••• ••••••••••••••••••••••
•••
(1)
(2) (3) (4)
(2) Application ID |
(4) Occurrence (constant/index) |
The SAVEPNT statement provides for rolling back a partial transaction; it marks a point within a transaction and establishes a savepoint name, either as a constant or as a value within the field specified. A subsequent ROLLBACK statement can then refer to the savepoint, discarding changes made after the savepoint but keeping changes made prior to the savepoint. Without a savepoint, the entire transaction is discarded.
Note, however, that APPXIO files do not support transaction processing. If you ROLLBACK a change to an RDBMS-hosted file, any changes made to APPXIO will not be rolled back. Related to this is the issue of visibility. Changes made to an RDBMS-hosted file are invisible to other users until they are committed. Changes made to an APPXIO-hosted file are visible immediately.
In the following example, if the flag indicates it is OK to commit, the COMMIT takes place and processing continues. Otherwise, changes made after the savepoint designated as TRX POINT 1 are discarded and the program branches to an applicable routine.
SAVEPNT TRX
POINT 1
*
<perform
RDBMS processing>
*
IF TAR
WORK OK TO COMMIT NE Y
T ROLLBACK TRX
POINT 1
T GOTO :TRX
POINT 1 STATUS
COMMIT