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
 

 

How to specify NULLIF for a decimal column in DB2 Load JCL
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
mfstudent1
Currently Banned

New User


Joined: 03 Mar 2006
Posts: 18

PostPosted: Tue Jan 08, 2008 9:10 pm    Post subject: How to specify NULLIF for a decimal column in DB2 Load JCL
Reply with quote

I want to load a DB2 table with a null value for a decimal column on it.

In the Load JCL,can we use the NULLIF statement to populate NULL value for a decimal field.
If yes,Please help me with the format of the statement.

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

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jan 08, 2008 9:57 pm    Post subject: Re: How to specify NULLIF for a decimal column in DB2 Load J
Reply with quote

mfstudent1 wrote:
I want to load a DB2 table with a null value for a decimal column on it.

In the Load JCL,can we use the NULLIF statement to populate NULL value for a decimal field.
If yes,Please help me with the format of the statement.

Thanks


Is the column defined as nullable?
Back to top
View user's profile Send private message
mfstudent1
Currently Banned

New User


Joined: 03 Mar 2006
Posts: 18

PostPosted: Tue Jan 08, 2008 10:01 pm    Post subject: Reply to: How to specify NULLIF for a decimal column in DB2
Reply with quote

icon_cool.gif

Yes it is defined as a Nullable column
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jan 08, 2008 10:11 pm    Post subject:
Reply with quote

How are going to tell when the column is null and when it is not? That is the condition you need to enter in the NULLIF statement.
Back to top
View user's profile Send private message
mfstudent1
Currently Banned

New User


Joined: 03 Mar 2006
Posts: 18

PostPosted: Tue Jan 08, 2008 10:15 pm    Post subject: Reply to: How to specify NULLIF for a decimal column in DB2
Reply with quote

Thanks for the update.

But i wanted to know how to use the NULLIF statement for a decimal column.
I have used nullif for other data types.But decimal field is always a comp-3 field.
How shud I specify the attributes?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jan 08, 2008 11:04 pm    Post subject: Re: Reply to: How to specify NULLIF for a decimal column in
Reply with quote

mfstudent1 wrote:
Thanks for the update.

But i wanted to know how to use the NULLIF statement for a decimal column.
I have used nullif for other data types.But decimal field is always a comp-3 field.
How shud I specify the attributes?


If the column is null for a row then there is no value for that column in that row just a null indicator with a -1 value.
Back to top
View user's profile Send private message
mfstudent1
Currently Banned

New User


Joined: 03 Mar 2006
Posts: 18

PostPosted: Tue Jan 08, 2008 11:35 pm    Post subject: Reply to: How to specify NULLIF for a decimal column in DB2
Reply with quote

I want to populate the Null value using a load jcl.
I just wanted to know how to use nullif condition for comp-3 field
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Jan 08, 2008 11:45 pm    Post subject: Re: Reply to: How to specify NULLIF for a decimal column in
Reply with quote

mfstudent1 wrote:
I want to populate the Null value using a load jcl.
I just wanted to know how to use nullif condition for comp-3 field

You use the NULLIF condition for a decimal column the same as you would for any other column.
Column definition
Code:
TOT_NSW_DOLLARS                 DEC(7,2),


then the load would be
Code:
"TOT_NSW_DOLLARS   " POSITION(  00603:00611) DECIMAL EXTERNAL(09,02) NULLIF(00602)=X'FF',


What don't you understand?
Back to top
View user's profile Send private message
mfstudent1
Currently Banned

New User


Joined: 03 Mar 2006
Posts: 18

PostPosted: Wed Jan 09, 2008 12:09 am    Post subject: Reply to: How to specify NULLIF for a decimal column in DB2
Reply with quote

Thanks a lot for the response.

I will try this and let you know the update...
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Jan 09, 2008 1:10 am    Post subject:
Reply with quote

mfstudent1: Based on what Craq Giegerich said, you need to ensure that you have a byte before your field that is set to x'FF' if you want a NULL. It won't matter what the value of the actual field is then.
Back to top
View user's profile Send private message
mfstudent1
Currently Banned

New User


Joined: 03 Mar 2006
Posts: 18

PostPosted: Wed Jan 09, 2008 1:20 am    Post subject: Reply to: How to specify NULLIF for a decimal column in DB2
Reply with quote

But i want to check the actual value in comp-3 field and then populate a null for the column
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jan 09, 2008 1:37 am    Post subject: Re: Reply to: How to specify NULLIF for a decimal column in
Reply with quote

mfstudent1 wrote:
But i want to check the actual value in comp-3 field and then populate a null for the column


I will ask AGAIN. How are you going to determine if the field is going to be null? And what is the format of the field?
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Jan 09, 2008 1:42 am    Post subject:
Reply with quote

If the value is stored comp-3 it should be a valid numeric, why NULL the DB column when you have a valid value?

Do you want NULL if that value is negative or 0 or 12.789889? What is the rule for NULLING?
Back to top
View user's profile Send private message
mfstudent1
Currently Banned

New User


Joined: 03 Mar 2006
Posts: 18

PostPosted: Wed Jan 09, 2008 1:50 am    Post subject: Reply to: How to specify NULLIF for a decimal column in DB2
Reply with quote

My question is straight forward.

is there a way to populate a null value in the decimal column.I don't want to use another field value to populate null value in this field.

I hope iam clear
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Jan 09, 2008 1:56 am    Post subject:
Reply with quote

Your question is far from straight forward.

To answer your "straight forward question", yes there is a way to populate a NULL value in a decimal column.

However you are also saying you want to populate based on a 'comp-3' field in a file. By saying 'based on', you are implying that you are using some value to determine whether or not a NULL needs to be inserted. NULLIF requires some sort of conditional check, hence the "IF" part of the statement.

What do you want to check to determine whether or not the NULL is to be inserted? The value in the COMP-3? If so what cases will result in a NULL being inserted?
Do you want every row to have a NULL for that column? This is far easier to accomplish because no NULLIF is needed, just specify NULL for that column.
Back to top
View user's profile Send private message
mfstudent1
Currently Banned

New User


Joined: 03 Mar 2006
Posts: 18

PostPosted: Wed Jan 09, 2008 2:04 am    Post subject: Reply to: How to specify NULLIF for a decimal column in DB2
Reply with quote

Thanks for the update.

Can I always populate a null value for nullable column which is a decimal one.Here I dont want to check the data in the field .I Just want to populate a null value always
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Jan 09, 2008 2:07 am    Post subject:
Reply with quote

Have you tried coding NULLIF (1=0)
Back to top
View user's profile Send private message
mfstudent1
Currently Banned

New User


Joined: 03 Mar 2006
Posts: 18

PostPosted: Wed Jan 09, 2008 2:09 am    Post subject: Reply to: How to specify NULLIF for a decimal column in DB2
Reply with quote

Wat do you mean by (1=0) here?
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Wed Jan 09, 2008 2:11 am    Post subject:
Reply with quote

Whoops that should be NULLIF(1=1) since that will always be true or maybe NULLIF(TRUE) or have the DBA set the column to have a default value of NULL when a value is not provided.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Jan 09, 2008 2:26 am    Post subject:
Reply with quote

If you want every row to be null in that column then don't even have it in the load!
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
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm


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