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

Unable to understand why Null indicator is used here


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

New User


Joined: 01 Dec 2006
Posts: 29
Location: S.A

PostPosted: Tue May 15, 2007 1:49 pm
Reply with quote

Hi,

What does W00-Null-Ind tells in this Select querry.

W00-NULL-IND variable is of S9(4), initialized as 0.

Querry is :

EXEC SQL
SELECT CUST_ACNT_N
,CLOSD_D
,CENT_FULL_IBT_N
INTO :DCLACNT.CUST-ACNT-N
,:DCLACNT.CLOSD-D:W00-NULL-IND
,:CENT-FULL-IBT-N
FROM IBIS.CUST_ACNT
,IBIS.CENTRE
WHERE CUST_ACNT_N = :DCLACNT.CUST-ACNT-N
AND CENTR_N = CENT_CENTR_N
WITH UR
END-EXEC

I am unable to understand why this W00-NULL-IND is used ??

Thanks,
Back to top
View user's profile Send private message
ashwinreddy

Active User


Joined: 16 Sep 2004
Posts: 106
Location: Hyderabad

PostPosted: Tue May 15, 2007 2:26 pm
Reply with quote

Hi,

If a column is Not null and the null indicator will have the information as whether the column has some data or it is null.

In your case you select that indictor values into your variable W00-NULL-IND.

Depending upon the value you will populate the values in DCLACNT.CLOSD-D.

As if W00-NULL-IND = 0

we assume that the column contains some value.

If you doesn't handle the null indicator you will get -305 (as you might be aware)

Cheers
Ashwin
Back to top
View user's profile Send private message
vab987

New User


Joined: 01 Dec 2006
Posts: 29
Location: S.A

PostPosted: Fri May 18, 2007 4:17 pm
Reply with quote

Hi Ashwin,

Thanks a lot.... but couldn't understand abt Handling null indicator.
Do u man that if we don't check the Null indicator (whether it contains zeros or some value ), we will get some error ?


Thanks in advance
Vab
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat May 19, 2007 2:40 am
Reply with quote

Hello,

On data that may be NULLed, you must check the null indicator to see if you have data before using it. Only when there actually is data should you use the data.

If you use the data and there was none (i.e. it was null), your results may vary (anything from incorrect processing to an abend).
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 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 Cobol prog to put an indicator on the... JCL & VSAM 1
No new posts the system or user abend SF0F R=NULL COBOL Programming 0
No new posts Infosphere Optim - unable to save Col... IBM Tools 0
Search our Forums:

Back to Top