Page 1 of 2

time conversion

Posted: Mon Feb 01, 2010 10:47 am
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!!

Posted: Mon Feb 01, 2010 11:19 am
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?

Posted: Mon Feb 01, 2010 12:37 pm
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.

Posted: Mon Feb 01, 2010 3:25 pm
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.

Posted: Mon Feb 01, 2010 10:58 pm
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.

Posted: Mon Feb 01, 2010 11:19 pm
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.

Posted: Mon Feb 01, 2010 11:51 pm
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

Posted: Tue Feb 02, 2010 12:50 am
by ray.wurlod
9:59:59 is not matched by %hh:%nn:%ss format.

Posted: Tue Feb 02, 2010 2:55 am
by srinivasayedla
HI RAY,
Can u get me the solution for this, i was strucked with this.

Posted: Tue Feb 02, 2010 3:00 am
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.

Posted: Thu Feb 04, 2010 10:03 am
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.

Posted: Mon Feb 08, 2010 8:31 am
by chulett
Perhaps something similar could be done but the problem here is with time conversion only, there's no date or timestamp involved.

Posted: Mon Feb 08, 2010 10:17 am
by anbu
Prefix 0 if hour is one char

Code: Select all

Right('0':Field(InputColumn,':',1),2)

Posted: Mon Feb 08, 2010 11:43 am
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

Posted: Mon Feb 08, 2010 11:52 am
by chulett
Sreenivasulu wrote:What does %(aa,w) stand for ?
Check the post the advice came from.