
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
Store Null Value in DB2 Table Using COBOL Program
We will make use of NULL indicator in order to store a NULL value in any column of a DB2 table. Firstly, we should move a value -1 in the NULL indicator in our COBOL-DB2 program. After that we execute UPDATE or INSERT query to store the NULL value.
For example, if we have to update a NULL value in the ORDER_DESCRIPTION column of the ORDER table where ORDER_ID is 3345612.
A020-UPDATE-ORDERS. MOVE -1 TO ORDER-DESCRIPTION-N MOVE SPACES TO ORDER-DESCRIPTION-DATA EXEC SQL UPDATE ORDERS SET ORDER_DESCRIPTION = :ORDER-DESCRIPTION-DATA :ORDER-DESCRIPTION-N WHERE ORDER_ID = ‘3345612’ END-SQL.
ORDER-DESCRIPTION-N is the NULL indicator here. The important point to note here is that the second line in the paragraph i.e the line highlighted with orange is optional. Once we have moved -1 in the null indicator then no matter what value we give in the data field, only NULL value will be stored in DB2 table.
Advertisements