6. QUEL and EQUEL Statements : Savepoint Statement--Declare Marker in an MQT : Example
 
Share this page                  
Example
This example shows a typical use of the savepoint statement. During each loop of the program, a savepoint is declared, enabling the program to back out updates in the event of an error:
## begin transaction
  saveindex = 0
  loop until finished processing
 saveindex = saveindex + 1
## savepoint saveindex
  process data
  if error condition then
##  abort to saveindex
    saveindex = saveindex - 1
  end if
 end loop
## end transaction