type conversion

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
laxmi_etl
Charter Member
Charter Member
Posts: 117
Joined: Thu Sep 28, 2006 9:10 am

type conversion

Post by laxmi_etl »

Hi,

I am reading from a file and writing to another file.
One of the fields need a string to date conversion I used the function
String To Date conversion in the Transformer.
When I use it it's giving out put ***** manner.

What is the reason for it?

Input data is 20061203 format output I need to get 2006-12-03.

But most of the records has 00000000 values in that field.
So I tried to give values to the null but that one also not working for
it

Is there any suggestions.

Thanks
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

What is the derivation that you are providing? Post all methods you have tried, specifically the format you are giving for the conversion.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
laxmi_etl
Charter Member
Charter Member
Posts: 117
Joined: Thu Sep 28, 2006 9:10 am

Post by laxmi_etl »

StringToDate(DSLink9.A,"%yyyy-%mm-%dd")
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Provide

Code: Select all

StringToDate(DSLink9.A,"%yyyy%mm%dd") 
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
laxmi_etl
Charter Member
Charter Member
Posts: 117
Joined: Thu Sep 28, 2006 9:10 am

Post by laxmi_etl »

In one way it's working.

I mean if the record has 20060303 that function is working
If the value is in 00000000 then it is giving **** value
laxmi_etl
Charter Member
Charter Member
Posts: 117
Joined: Thu Sep 28, 2006 9:10 am

Post by laxmi_etl »

If the record has 00000000 value in that field that I am supposed to conver to date then I have given the fallwoing function.

If IsNull(DSLink9.A) Then 0 Else (StringToDate(DSLink9.A,"%yyyy%mm%dd"))

but it is giving fallowing error while compiling.
Invalid conversion requested while converting int8 to date
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Becuase 000000 is not null. Look for '00000000', if found, set to null, else apply the StringToDate() function.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
laxmi_etl
Charter Member
Charter Member
Posts: 117
Joined: Thu Sep 28, 2006 9:10 am

Post by laxmi_etl »

It is working.

Thanks
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Great. Mark the post as resolved then.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply