- 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
What is the purpose and usage of SQLCODE within the SQLCA in a COBOL-DB2 program
The SQLCODE field of SQLCA is used to get the return code for the last executed SQL query from DB2 to COBOL program. Below are the range of return codes which SQLCODE field can take along with their significance.
SQLCODE = 0 → Query executed successfully without any issue.
SQLCODE > 0 → There was a warning issued while executing the query.
SQLCODE < 0 → There was an error occurred while executing the query.
Below is the sample paragraph where the usage of SQLCODE is demonstrated.
A010-CHECK-ORDER. EXEC SQL SELECT ORDER_DATE INTO :ORDER-DATE, FROM ORDERS WHERE ORDER_ID = :ORDER-ID END-EXEC EVALUATE SQLCODE WHEN 0 DISPLAY ‘ROW FETCHED SUCCESSFULLY’ WHEN 100 DISPLAY ‘DATA NOT FOUND’ WHEN OTHER DISPLAY ‘ERROR WHILE FETCHING THE ROW’ SQLCODE END-EVALUATE
- Related Articles
- How to use SQLCA in a COBOL-DB2 program? What is the purpose of SQLCA?
- Purpose and usage of SAVEPOINT in COBOL-DB2 program
- What is the purpose and usage of “WHERE CURRENT OF” clause in a COBOL-DB2 program?
- What is the purpose and usage of “FOR UPDATE OF” clause in a COBOL-DB2 program
- What is the usage and purpose of DCLGEN and host variables used in COBOL-DB2 program
- What will be the result if SQLCA is not included in a COBOL-DB2 program?
- Purpose and usage of ROW-ID and SEQUENCE in a DB2
- What is the purpose and usage of SCROLLABLE CURSOR in COBOLDB2 program?
- Impact of database downtime on the COBOL-DB2 program
- Steps involved in compilation of a COBOL-DB2 program
- Implementation of restart logic in a COBOL-DB2 program
- What is the purpose of the "FOR UPDATE OF" clause in a cursor? What will happen if we fire an UPDATE statement without using this clause in a COBOL-DB2 program?
- How to precompile a COBOL-DB2 program?
- What is the definition and usage of alternate key in a DB2 table?
- How can you revert all the DB2 table changes done in a COBOL-DB2 program?

Advertisements