time conversion

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

srinivasayedla
Participant
Posts: 10
Joined: Thu Jan 28, 2010 1:03 am
Location: hyderabad

time conversion

Post by srinivasayedla »

Hi All,
I have a sequential file, which has the time field. I was unable to transfer the records which has the time format '0:00:00' i.e the records of 0:00:00 to 9:59:59 were not loading into my target table. My target column has Time field and iam using an transformer stage.

can anyone help with this, pls!!
sri
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Details, please. I could guess but I'd really rather not. What database and what is your target field type? What exactly are you doing now and what errors are you seeing?
-craig

"You can never have too many knives" -- Logan Nine Fingers
bollinenik
Participant
Posts: 111
Joined: Thu Jun 01, 2006 5:12 am
Location: Detroit

Post by bollinenik »

Hi,
Please post exact error message and database type, length as well

what was other format records, which was successfully inserted into that column.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The default time format has two digits for the hour component. You have to use a different format, by overriding the default either explicitly in your transformation function or by changing the system-wide default. I would prefer the former.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
srinivasayedla
Participant
Posts: 10
Joined: Thu Jan 28, 2010 1:03 am
Location: hyderabad

Post by srinivasayedla »

Hi,
My target database is DB2, and the fieldtype of the column is TIME of length 8.My sequential file contains time column which has fieldtype of varchar. i used the following type conversion in transformer stage,
StringToTime(DSLink3.Obs_tm,"%hh:%nn:%ss"), but i was unable to load the whole data.
sri
srinivasayedla
Participant
Posts: 10
Joined: Thu Jan 28, 2010 1:03 am
Location: hyderabad

Post by srinivasayedla »

and iam facing the warning as,
DB2_IND_SOI,0: Invalid time value in getInputFieldAsTime() for field '3' of input dataset '0'.

thanx in advance.
sri
srinivasayedla
Participant
Posts: 10
Joined: Thu Jan 28, 2010 1:03 am
Location: hyderabad

Post by srinivasayedla »

few more warnings i got are,
Sequential_File_0: When validating import schema: Unrecognized top level format property: time_format="%hh:%nn:%ss"
Transformer_2,1: Conversion error calling conversion routine time_from_string data may have been lost
sri
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

9:59:59 is not matched by %hh:%nn:%ss format.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
srinivasayedla
Participant
Posts: 10
Joined: Thu Jan 28, 2010 1:03 am
Location: hyderabad

Post by srinivasayedla »

HI RAY,
Can u get me the solution for this, i was strucked with this.
sri
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I don't know whether U (one of our posters can get you the solution). Why not send U an email or private message?

The format string "%hh:%nn:%ss" expects two digits in the hour component. I mentioned that before. Your data only has one.

You need to handle that with a different format string, or by adding leading zero when it occurs.
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 »

In a private email, srinivasayedla wrote:Hi Chulett,

I had post with the subject time conversion in general forum in dsxchange, I couldn't get the solution for the problem. I request you to go through that and provide me an solution for that. I really got strucked with my work.
Please help me regarding this.
Request away, but that's not the way it works here and this had no business coming to me in a private email. If you still have questions you need to post them here so anyone can help you. In this specific case that means anyone with DB2 experience and, as I've noted here many times, that's not me.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Perhaps something similar could be done but the problem here is with time conversion only, there's no date or timestamp involved.
-craig

"You can never have too many knives" -- Logan Nine Fingers
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Prefix 0 if hour is one char

Code: Select all

Right('0':Field(InputColumn,':',1),2)
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

chulett wrote:Perhaps something similar could be done but the problem here is with time conversion only, there's no date or timestamp involved.
What does %(aa,w) stand for ?

Regards
Sreeni
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sreenivasulu wrote:What does %(aa,w) stand for ?
Check the post the advice came from.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply