Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Load NULLS to this date field in DB2

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
candyboy

New User


Joined: 13 Nov 2006
Posts: 10

PostPosted: Tue Jan 06, 2009 8:24 am    Post subject: Load NULLS to this date field in DB2
Reply with quote

Hi,

I have a field defined as X(10) in which i normally store a date like '2009-01-01'. This field corresponds to a DATE (DB2 datatype DATE) field in DB2 table. I basically load my X(10) field to this DATE field in DB2.

I have a requirement now to load NULLS to this date field in DB2. Could you let me know what should I move in the X(10) field to achieve nulls in the date field on table. Or if there is some other way to do it....let me know.

Thanks!!
CB
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 Jan 06, 2009 8:46 am    Post subject:
Reply with quote

Hello,

If there is still time, i would suggest that you not use NULL. . . It may well be that others in your organization are not familiar with NULL also.

There is no actual "null" value - NULL is the absence of any value. When using NULL, a column needs 2 host variable entries - one for the actual value of the data and the other to indicate whether there is a value or not. This is known as the NULL indicator.

Suggest you talk with your dba for some samples of other tables/columns that are defined as NULLable and the code used to select/insert/update them if NULL must be used.
Back to top
View user's profile Send private message
Gnanas N

Active Member


Joined: 06 Sep 2007
Posts: 788
Location: Chennai, India

PostPosted: Tue Jan 06, 2009 10:38 am    Post subject:
Reply with quote

Hi,

Will these work?

1. Just omit date field while inserting...

2. Use NULL while inserting...

Sorry, I'm not sure if this suits for your requirement. icon_sad.gif
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 06, 2009 6:01 pm    Post subject:
Reply with quote

Is the column in the DB2 table defined as nullable. If it is then just set the null indicator to -1 when you do an insert.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2285
Location: @my desk

PostPosted: Tue Jan 06, 2009 6:46 pm    Post subject:
Reply with quote

candyboy,

Do you use some LOAD utility to achieve this?
I believe the BMC LOADPLUS has some option to load the column as NULL if the value in the file equals ' '(space) or some constant.
Back to top
View user's profile Send private message
candyboy

New User


Joined: 13 Nov 2006
Posts: 10

PostPosted: Tue Jan 06, 2009 7:58 pm    Post subject: Reply to: Load NULLS to this date field in DB2
Reply with quote

Hi All,

Yes the field is defined as nullable in the table and under normal circumstances, the null indicator is used with value -1 while writing the field to table. This is when we use proper modules & view handlers.

But currently we are loading table using a load file. We are using DSNUTILB for loading.

The issue we have rite now is:
I have a table with fields say A,B,C &D where C being the nullable Date field.
To load this table we are creating a load file with fields A,B,C & D.

Now if I accomodate a Null indicator in my load file (A,B,C,C-NI,D) , the length of my load file increases and this pushes the remaining fields further causing load to fail.

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Tue Jan 06, 2009 8:31 pm    Post subject:
Reply with quote

have you thought of modifiying the mask definition to accomodate the extra length in the input record length?
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 06, 2009 8:36 pm    Post subject:
Reply with quote

Put the null indicator after the last field or use the first byte of the date field to indicate that it should be null. Or change your load control cards which you would have to do anyways!
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us