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