
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Purpose and Usage of SQLCODE within SQLCA in 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
Advertisements