View previous topic :: View next topic
|
Author |
Message |
chkiran2
New User
Joined: 24 Jun 2004 Posts: 24 Location: Gurgoan
|
|
|
|
I am Selecting some data from DB2 using SQL in COBOL program. If a column in DB2 contains Null how to capture and test that the column is Null in Cobol Program. If you can give the code that will be helpful.
Regards,
Kiran |
|
Back to top |
|
|
rick
New User
Joined: 18 Jun 2004 Posts: 59 Location: Chennai
|
|
|
|
Hi,
You can use a null indicator variable. If the indicator variable is -1 then the filed is NULL else it is not null
Code: |
EXEC SQL SELECT NAME INTO :NAME INDICATOR :NAME-IND FROM <table name> WHERE ID = 10
END-EXEC.
IF NAME-IND = -1
DISPLAY "NULL
ELSE
DISPLAY "NOT NULL".
|
where NAME AND NAME-IND are host variable to be declared in WS section |
|
Back to top |
|
|
|