title: Batch DB2 Performance of COMMIT/ROLLBACK VS ROLLBACK TO SAVEPOINT
body: <p>In a COBOL batch program what is better in performance terms?</p>
  
  <p>With commit:</p>
  
  <pre><code>IF SW-NEW-TRANSACT
    EXEC SQL
        COMMIT
    END-EXEC
  END-IF.
  PERFORM SOMETHING
     THRU SOMETHING-EXIT.
  IF SW-ERROR
    EXEC SQL
        ROLLBACK
    END-EXEC
  END-IF.
  </code></pre>
  
  <p>With syncpoints:</p>
  
  <pre><code>IF SW-NEW-TRANSACT
    EXEC SQL
        SAVEPOINT NAMEPOINT ON ROLLBACK RETAIN CURSORS
    END-EXEC
  END-IF.
  PERFORM SOMETHING
     THRU SOMETHING-EXIT.
  IF SW-ERROR
    EXEC SQL
        ROLLBACK TO SAVEPOINT NAMEPOINT
    END-EXEC
  END-IF.
  </code></pre>