Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Unable to understand why Null indicator is used here

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Unable to understand why Null indicator is used here
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Sat May 19, 2007 2:40 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts I am unable to use SWAPBAR ON command... mrsidhu12 TSO/ISPF 3 Thu Sep 01, 2016 1:10 pm
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
No new posts Compare 2 files & write Indicator... nagendrapgupta SYNCSORT 5 Sun May 15, 2016 10:42 am
No new posts GetObjectArrayElement returns NULL Majid Hussain Java & MQSeries 2 Wed Mar 30, 2016 2:59 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us