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 SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Adding 'ODD' and 'EVEN' indicator at ... DFSORT/ICETOOL 6
No new posts How to check whether who renamed the ... JCL & VSAM 3
Search our Forums:

Back to Top