IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to check Null Indicator


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chkiran2

New User


Joined: 24 Jun 2004
Posts: 24
Location: Gurgoan

PostPosted: Mon Jun 28, 2004 1:26 pm
Reply with quote

icon_redface.gif
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
View user's profile Send private message
rick

New User


Joined: 18 Jun 2004
Posts: 59
Location: Chennai

PostPosted: Tue Jun 29, 2004 5:17 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts check if two PD values are equal, no ... DFSORT/ICETOOL 4
This topic is locked: you cannot edit posts or make replies. Check if it is certain hour, then pro... JCL & VSAM 25
No new posts Numeric check on packed signed and un... COBOL Programming 4
No new posts Difference between VALIDPROC and CHEC... DB2 3
No new posts Uploading from desktop, a CSV file, s... DB2 2
Search our Forums:

Back to Top