- 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
How to store a NULL value in a particular column of a DB2 table using COBOL-DB2 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.
- Related Articles
- How to verify NULL value in DB2 column data using COBOL paragraph?
- How to get the list of all COBOL-DB2 programs using a DB2 table TAB1?
- How to precompile a COBOL-DB2 program?
- How can you revert all the DB2 table changes done in a COBOL-DB2 program?
- Implementation of a table level locks in a COBOL-DB2 program during program execution
- Implementation of a table level locks in a COBOL-DB2 program during SQL execution
- Steps involved in compilation of a COBOL-DB2 program
- Implementation of restart logic in a COBOL-DB2 program
- How to execute a COBOL-DB2 program PROGA of plan PLANA?
- How NON-REPEATABLE READ & PHANTOMS impact functioning of a COBOL-DB2 program?
- What will happen if a NULL value is detected for a SQL statement in COBOL-DB2 program and the NULL indicator is not used?
- How can a COBOL-DB2 program call a STORED PROCEDURE? Give an example.
- How to use SQLCA in a COBOL-DB2 program? What is the purpose of SQLCA?
- Purpose and usage of SAVEPOINT in COBOL-DB2 program
- How to delete a DB2 table TAB1?

Advertisements