Interview Questions   Tutorials   Discussions   Programs   

DB2 - What is commit & rollback? When and where is used while compiling a cobol-db2 program?




957
views
asked mar September 2, 2014 11:08 AM  

What is commit & rollback? When and where is used while compiling a cobol-db2 program?


           

1 Answers



 
answered By Mswami   0  
A process always has to COMMIT or ROLLBACK database work at some point. A COMMIT is taken between transactions (between complete units of work). COMMIT may be taken after each transaction or, as is common in batch processing, after some multiple number of transactions. A COMMIT should never be taken mid-transaction (this defeats the UNIT OF WORK concept).

Example:

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.


Commit is used when the changes in the record is to be made permanent.

It is coded in Cobol-DB2 program after some frequency of record is processed.

Rollback is Issued by the DB2 system/will be coded by user when any abend/error occurs while processing. 
flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert