 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP 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
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
Advertisements
 