StringToTimestamp err

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

efxuser
Premium Member
Premium Member
Posts: 50
Joined: Tue Jun 24, 2008 9:00 am

StringToTimestamp err

Post by efxuser »

I am trying to using this function StringToTimestamp(DSLink8.Eff_date,%yyyy-%mm-%dd %hh:%nn:%ss)

DSLink8.Eff_date this is a string.I dont mind if the timepart is default.
Transformer_7,2: Conversion error calling conversion routine timestamp_from_string data may have been lost

I searched red the documentation can t seem to fix this.

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

Post by ray.wurlod »

Please give some examples of the content in DSLink8.Eff_date field.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Did you do

Code: Select all

StringToTimestamp(DSLink8.Eff_date,"%yyyy-%mm-%dd %hh:%nn:%ss") 
OR

Code: Select all

StringToTimestamp(DSLink8.Eff_date,%yyyy-%mm-%dd %hh:%nn:%ss) 
efxuser
Premium Member
Premium Member
Posts: 50
Joined: Tue Jun 24, 2008 9:00 am

Post by efxuser »

My job is seq file -> tx -> or db table.

DSLink8.Eff_date looks like this 2/3/2009.I am trying to use stringtotimestamp function in the transformer.My time part in the timestamp can be default.I tried various combination as the sainath suggested but still i get the same warning. I am on 7.5.1a

Thanks
EFX
bart12872
Participant
Posts: 82
Joined: Fri Jan 19, 2007 5:38 pm

Post by bart12872 »

try
StringToTimestamp(DSLink8.Eff_date:' 00:00:00',"%mm/%dd/%yyyy %hh:%nn:%ss")
betterthanever
Participant
Posts: 152
Joined: Tue Jan 13, 2009 8:59 am

Post by betterthanever »

efxuser wrote:My job is seq file -> tx -> or db table.

DSLink8.Eff_date looks like this 2/3/2009.I am trying to use stringtotimestamp function in the transformer.My time part in the timestamp can be default.I tried various combination as the sainath suggested but still i get the same warning. I am on 7.5.1a

Thanks
here is what you need to do ..

Code: Select all

StringToTimestamp('2/3/2009',"%(d,s)/%(m,s)/%yyyy")
efxuser
Premium Member
Premium Member
Posts: 50
Joined: Tue Jun 24, 2008 9:00 am

Post by efxuser »

I tried the suggestions. ->
For StringToTimestamp('2/3/2009',"%(d,s)/%(m,s)/%yyyy") , I got the below warning.
Transformer_7,1: Caught exception from runLocally(): APT_ParseError: Parsing parameters "%(d,s)/%(m,s)/%yyyy" for conversion "timestamp=timestamp_from_string[%yyyy-%mm-%dd %hh:%nn:%ss](string)": APT_Conversion_String_TimeStamp: Invalid Format [%(d,s)/%(m,s)/%yyyy] used for string_from_time type conversion.


the format StringToTimestamp(DSLink8.Eff_date:' 00:00:00',"%mm/%dd/%yyyy %hh:%nn:%ss") gave my initial warning also.
EFX
betterthanever
Participant
Posts: 152
Joined: Tue Jan 13, 2009 8:59 am

Post by betterthanever »

efxuser,

i dont know if something to do with the version youa re using, but tested on 8.0.1 version before i posted it.
and it works!!!!
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Code: Select all

StringToTimestamp(DSLink8.Eff_date:' 00:00:00',"%m/%d/%yyyy %hh:%nn:%ss") 
Or simply to a StringToDate and use it as a date.
betterthanever
Participant
Posts: 152
Joined: Tue Jan 13, 2009 8:59 am

Post by betterthanever »

[quote="Sainath.Srinivasan"][code]StringToTimestamp(DSLink8.Eff_date:' 00:00:00',"%m/%d/%yyyy %hh:%nn:%ss") [/code]

Or simply to a StringToDate and use it as a date.[/quote]

the one sainath suggested also works. i tested it.
efxuser
Premium Member
Premium Member
Posts: 50
Joined: Tue Jun 24, 2008 9:00 am

My version is 7.5.1.A

Post by efxuser »

My version is 7.5.1.A
EFX
betterthanever
Participant
Posts: 152
Joined: Tue Jan 13, 2009 8:59 am

Re: My version is 7.5.1.A

Post by betterthanever »

[quote="efxuser"]My version is 7.5.1.A[/quote]

may be someone else with your version has to chime in ...
betterthanever
Participant
Posts: 152
Joined: Tue Jan 13, 2009 8:59 am

Re: My version is 7.5.1.A

Post by betterthanever »

"repost"
bart12872
Participant
Posts: 82
Joined: Fri Jan 19, 2007 5:38 pm

Post by bart12872 »

not very elegant but still works

StringToTimestamp(Right('0':Field(DSLink8.Eff_date,'/',1),2):'/':Right('0':Field(DSLink8.Eff_date,'/',2),2):'/':Field(DSLink8.Eff_date,'/',3) :' 00:00:00',"%mm/%dd/%yyyy %hh:%nn:%ss")
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

The format must not be dependant on the version.
Post Reply