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
 

 

Null Indicator handling

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Mon Feb 16, 2009 10:42 pm    Post subject: Null Indicator handling
Reply with quote

If a DB2 table variable is defined as a NOT NULL. And from the cobol program during the executing of a INSERT or UPDATE query for that field, we will active the Null Indicator, will it abend?

If it is defined as NOT NULL WITH DEFAULT still will it abend?

OR, what data will be populate in that field?
Back to top
View user's profile Send private message

Bharath Bhat

Active User


Joined: 20 Mar 2008
Posts: 283
Location: chennai

PostPosted: Mon Feb 16, 2009 11:58 pm    Post subject:
Reply with quote

Quote:
we will active the Null Indicator


Can you elaborate?
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: Tue Feb 17, 2009 2:31 am    Post subject:
Reply with quote

Hello,

As asked - please elaborate. . .

fwiw - if the column is defined as NOT NULL, there will be no null indicator in the host variables. . .
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue Feb 17, 2009 10:20 am    Post subject:
Reply with quote

Just I am asking if Null Indicator has been used for NOT NULL coloumns during INSERT & UPDATE, what will happen? It will abend or it will execute successfully but DB2 table will be unchanged.
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: Tue Feb 17, 2009 10:38 am    Post subject:
Reply with quote

Hello,

Please post the dclgen for one of these tables (only a small number of columns and at least one that is not nullable) and the insert sql for the same table.

I believe i am misunderstanding something as there should be no "null indicator" variables for columns that do not support a null value.
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue Feb 17, 2009 11:23 am    Post subject:
Reply with quote

Dclgen:
-----------
10 A-1 PIC X(2).



Code:
----------
Move -1 to WS-NULL-IND1.

Insert Into TableA
(A_1
)
Vaues
(:A-1 ::WS-NULL-IND1
)
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: Tue Feb 17, 2009 11:27 am    Post subject:
Reply with quote

Hello,

If A_1 is defined as NOT NULL, i believe you will get an sql error.

Should be a painless test icon_wink.gif
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue Feb 17, 2009 11:29 am    Post subject:
Reply with quote

A_1 is defined as NOT NULL.
Thanks alot.
It will be very helpful for me if you mantion the sqlcode.
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: Tue Feb 17, 2009 11:30 am    Post subject:
Reply with quote

Hello,

Which is why i mentioned:
Quote:
Should be a painless test icon_wink.gif
Back to top
View user's profile Send private message
Debasis Misra
Warnings : 1

New User


Joined: 16 Sep 2008
Posts: 72
Location: Bangalore

PostPosted: Tue Feb 17, 2009 11:33 am    Post subject:
Reply with quote

I got.
sqlcode -407.
Back to top
View user's profile Send private message
muthuvel

Active User


Joined: 29 Nov 2005
Posts: 217
Location: Chennai

PostPosted: Tue Feb 17, 2009 11:59 am    Post subject:
Reply with quote

Yes,
Quote:
407 is AN UPDATE, INSERT, OR SET VALUE IS NULL, BUT THE OBJECT COLUMN CANNOT CONTAIN NULL VALUES


They may have defined it as not null because it could have been for some business specific requirements.Analyse the reason with ur DA/DBA on this and then if it is of no impact on removing the NOT NULL ,then have it removed.
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: Tue Feb 17, 2009 8:38 pm    Post subject:
Reply with quote

Hello,

Suggest you NOT remove the not null. Suggest you remove the null indicator(s) from the code where they should not be.

Many places i support require a specific exception to define a column as nullable. A common/growing feeling is that nulls are more trouble than they are worth. Especially considering the growing number of people who work with databases (even dbas) that are not "database people" . . .
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 Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
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


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