- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can you revert all the DB2 table changes done in a COBOL-DB2 program?
We can revert all the changes done on a COBOL-DB2 program using the ROLLBACK statement. However, ROLLBACK is only applicable until COMMIT has not been issued. If we have used a COMMIT statement, then ROLLBACK will revert all the changes made in DB2 tables after the last COMMIT point.
For example, after the commit statement, we execute an UPDATE statement to modify the ORDER_PAID column of ORDERS table. After that if we fire ROLLBACK then the UPDATE on the ORDERS table will be reverted.
Example
EXEC SQL COMMIT END-EXEC EXEC SQL UPDATE ORDERS SET ORDERS_PAID = ‘YES’ WHERE ORDER_DATE = :WS-CURRENT-DATE END-EXEC EXEC SQL ROLLBACK END-EXEC
In this case, after firing the ROLLBACK statement, all the changes made by UPDATE statement will be reverted.
- Related Articles
- How to get the list of all COBOL-DB2 programs using a DB2 table TAB1?
- How to store a NULL value in a particular column of a DB2 table using COBOL-DB2 program?
- How to precompile a COBOL-DB2 program?
- Implementation of a table level locks in a COBOL-DB2 program during program execution
- How will you keep the CURSOR open after firing COMMIT in a COBOL-DB2 program?
- How can a COBOL-DB2 program call a STORED PROCEDURE? Give an example.
- Steps involved in compilation of a COBOL-DB2 program
- Implementation of restart logic in a COBOL-DB2 program
- Implementation of a table level locks in a COBOL-DB2 program during SQL execution
- How will you detect the condition of the end of cursor rows in a COBOL-DB2 program?
- Impact of database downtime on the COBOL-DB2 program
- How to execute a COBOL-DB2 program PROGA of plan PLANA?
- Purpose and usage of SAVEPOINT in COBOL-DB2 program
- Write a DB2 query to find out all the duplicate INVOICE_ID in ORDERS DB2 table?
- How NON-REPEATABLE READ & PHANTOMS impact functioning of a COBOL-DB2 program?

Advertisements