Datetimeoverflow error

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
poornimajayan
Participant
Posts: 16
Joined: Sun Apr 17, 2005 11:27 pm

Datetimeoverflow error

Post by poornimajayan »

Hi,
I am using DB2 as my target database.I am appending the timepart from the source datetime field with the currentdate like:

DSJobStartDate:' ':Substring(datefield,12,19)

If I do like

DSJobStartDate:' ':'00:00:00' the job is running fine.

But for the first one, it is giving the datetimeoverflow error.

Please suggest how to go with this.

Thanks,
Poornima
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

please make sure the time part is in correct format...and the quickest solution I can suggest is change the datatype in API stage to Char(19).

Can you please give example of time field.

HTH
poornimajayan
Participant
Posts: 16
Joined: Sun Apr 17, 2005 11:27 pm

Post by poornimajayan »

Hi,
My datetime field in the target is of the format 1900-01-01 00:00:00.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Substrings(x, 12, 19) returns a 19 character string, that may include fractional seconds if present. Did you want Substrings(x, 12, 9)?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

Man good catch Ray, How did I miss that... :roll:
poornimajayan
Participant
Posts: 16
Joined: Sun Apr 17, 2005 11:27 pm

Post by poornimajayan »

Hi Ray/Amsh.Thanks.
Even still the error persists.For a safer side, I put

Substrings(
DSJobStartDate:' ':Substring(datefield,12,9) ,1,19)
Still it remain the same.
As I mentioned, this work if I hardcode '00:00:00' for that last part instead of substring.But then my requirement is failing.

Thanks,
Poornima
amsh76
Charter Member
Charter Member
Posts: 118
Joined: Wed Mar 10, 2004 10:58 pm

Post by amsh76 »

Hey Poornima,

What is your data type ? DATE or TIMESTAMP ?

The other option you can try is converting the date and time in Internal format and then try to insert into DB2 table, via API stage.

Let us know...if it works.

Thanks.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Why not use the subtring operator [start,length] ????

link.col[1,10] : " 00:00:00"
should give you "2005-08-02 00:00:00" for today as date using YYYY-MM-DD format.

Doesn't that maco return an internal date format?
Why not use the start timestamp macro?

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
peterbaun
Premium Member
Premium Member
Posts: 93
Joined: Thu Jul 10, 2003 5:27 am
Location: Denmark
Contact:

Post by peterbaun »

Hi Poornima,

Will changing the expression to
Substrings(DSJobStartDate:' ':Substring(datefield,12,8) ,1,19)
make any change ?

(Changed the number of positions from 9 to 8 in the inner substring function.)

In any case - send the result of the substring to a flat file so you can see what you actually try to insert into the database. It often reveals the problem.

Regards
Peter
Last edited by peterbaun on Thu Aug 04, 2005 8:04 am, edited 1 time in total.
peterbaun
Premium Member
Premium Member
Posts: 93
Joined: Thu Jul 10, 2003 5:27 am
Location: Denmark
Contact:

Post by peterbaun »

hello again -

something went wrong in the copy-paste.
To be clear -

Substrings(DSJobStartDate : ' ' : Substring(datefield, 12, 8), 1, 19)
Last edited by peterbaun on Thu Aug 04, 2005 8:04 am, edited 1 time in total.
peterbaun
Premium Member
Premium Member
Posts: 93
Joined: Thu Jul 10, 2003 5:27 am
Location: Denmark
Contact:

Post by peterbaun »

I give up -

DSJobStartDate[1,10] : ' ' : datefield[12,8]
gpatton
Premium Member
Premium Member
Posts: 47
Joined: Mon Jan 05, 2004 8:21 am

Post by gpatton »

When using DB2 define the datetime variable as varchar 26

Then use the format 00:00:00.00000 for the time portion of the datetime string.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

peterbaun, you need to check Disable Smilies in this post otherwise 8) will deliver the "cool" emoticon.
You can go back and edit your post and still accomplish this.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply