Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
How to check Null Indicator

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
Author Message
chkiran2

New User


Joined: 24 Jun 2004
Posts: 25
Location: Gurgoan

PostPosted: Mon Jun 28, 2004 1:26 pm    Post subject: How to check Null Indicator
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
References
PostPosted: Mon Jun 28, 2004 1:26 pm    Post subject: Re: How to check Null Indicator Reply with quote

rick

Moderator


Joined: 18 Jun 2004
Posts: 61
Location: Kuzhithurai

PostPosted: Tue Jun 29, 2004 5:17 pm    Post subject:
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1