- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Implementation of common error-trapping logic for all SQL statements in program
A COBOL-DB2 program can have multiple DB2 SQL statements. In order to implement the common error-trapping for all the SQL statements in a COBOL-DB2 program, we will use WHENEVER statement.
The WHENEVER statement can direct the control to the error handling section or routine based on the value returned in SQLCODE field of SQLCA. For example, we can declare WHENEVER statement in COBOL-DB2 program as below−
EXEC SQL WHENEVER SQLERROR GOTO ERROR-ROUTINE END-EXEC
In the above example, the SQLERROR parameter will be set only when the value of SQLCODE will be lesser than zero, which indicates that there was some error occurred while executing the query. In that case, the control will be transferred to the ERRORROUTINE paragraph of the program.
- Implementation of restart logic in a COBOL-DB2 program
- Mathematical Logic Statements and Notations
- Usage of backtick in SQL statements?
- What is Implementation of Three Address Code Statements?
- What kind of SQL statements can be used to prepare statements?
- Implementation of a table level locks in a COBOL-DB2 program during SQL execution
- C++ Program for Common Divisors of Two Numbers?
- Python Program for Common Divisors of Two Numbers
- Java Program for Common Divisors of Two Numbers
- Program for Fibonacci numbers in PL/SQL
- C++ Program for Longest Common Subsequence
- Java Program for Longest Common Subsequence
- Using SQL statements in ABAP Programming and Database performance
- Trapping Rain Water in Python
- C++ Program for the Common Divisors of Two Numbers?