Invalid timestamp value

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Invalid timestamp value

Post by jagadam »

Hi All,

Iam trying to run a job which extracts data from db2 using a Db2 Plugin stage and writing to a dataset.

While doing this I am getting the following error.

"Invalid timestamp value in setOutputFieldAs TimeStamp() for field'3' in output dataset '0'. Time stamp string = 2009-10-10-23 24:00:00.000000, format string = %yyyy-%mm-%dd %hh:%nn:%ss.6."

The input field is a timestamp and iam not using any conversions.

Thanks in advance for your help.

Thanks
Naveen.
NJ
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Are you extracting "2009-10-10-23 24:00:00.000000" from a char field in DB2?
You are the creator of your destiny - Swami Vivekananda
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Post by jagadam »

No, The field in the Db2 is a timestamp(26,6).
NJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

How the heck did your timestamp end up with a date value of "2009-10-10-23" in it? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Post by jagadam »

Hi

Sorry it should read like "2009-10-23" :)


Thanks
Naveen.
NJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK, then let's move on to the time portion. Ignoring the milliseconds, is it really coming over as "24:00:00"? I do not believe that is a valid time value in any system... 23:59:59 + 1 = 00:00:00 AFAIK.
Last edited by chulett on Thu Mar 04, 2010 8:55 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Post by jagadam »

Hi,

Thanks for your comments.
What you said is a valid point. when I filtered the data excluding the dates with time stamp "24:00:00".
Datastage passed the records. i.e the job ran fine with out any warnings.

But the source has the data with the above mentioned timestamp.

Is it a bug on the source side...? Is it valid to store the data as "24:00:00" in db2.

Thanks for your inputs.

Thanks
Naveen.
NJ
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

24:00:00 is not valid in DB2. Only 00:00:00 through 23:59:59 are valid.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Best to get that checked out, either by a DB2 DBA / support or DataStage support. Or both... one stop shopping. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Post by jagadam »

Hi,

When i ran the query using Db2 client the out put we are getting is "2009-10-24 00:00:00" but when running the same query in datastage using db2 plug in we are getting it as "2009-10-23 24:00:00".

Is it a problem with the db2 plug in connection..? Isn't it set up correctly..?


Thanks
Naveen.
NJ
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No clue, hence the suggestion to check with your support provider.
-craig

"You can never have too many knives" -- Logan Nine Fingers
jagadam
Premium Member
Premium Member
Posts: 107
Joined: Wed Jul 01, 2009 4:55 pm
Location: Phili

Post by jagadam »

Hi,

I opened a PMR with IBM on this Time format and they said that "24:00:00" is a valid db2 time format. So dont know how to handle this in datastage as I need to convert this into the next day date.
for example if it is

2010-05-12 24:00:00 then it needs be converted into 2010-05-13 00:00:00

Thanks
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

If Index(Fld,"24:00:00") = 1 Then DateFromDaysSince(1,Fld[1,10]) :" 00:00:00" Else Fld
You are the creator of your destiny - Swami Vivekananda
DWS
Premium Member
Premium Member
Posts: 23
Joined: Thu Oct 13, 2011 11:47 am

Post by DWS »

Old topic, but just stumbled upon this when searching for a resolution to the same problem. I found a different / better solution for our purposes though.

Since DS chokes on the DB2 date on attempted load, I found that this 'fixed' the issue for me...

Within the DB2 query I placed this:

SELECT CASE WHEN HOUR(BAD_DTTM) > 23 THEN BAD_DTTM - 1 MICROSECOND ELSE BAD_DTTM END AS GOOD_DTTM FROM TABLE;

Anyways, figured I'd share..
rahcomp
Participant
Posts: 11
Joined: Wed Apr 18, 2012 2:13 pm

Post by rahcomp »

- Could you cast the source column to varchar / date and try extracting ?
Rahul
DS Lover
Post Reply