Conversion error

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
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Conversion error

Post by rafidwh »

Hi All,

I am getting the following error while converting the date

Transformer,0: Conversion error calling conversion routine date_from_string data may have been lost.

The input date column is char(10) and the format is dd/mm/yyyy.
In the transformer I am validating the input date and converting the date into yyyymmdd .the output date datatype is integer.

In transformer iam using

sv1:IsValid("Date", StringToDate(OutDate.DATE,"%dd/%mm/%yyyy"))

sv2:If (sv1 = @FALSE Or IsNull(OutDate.DATE) )Then -1 Else DateToString(StringToDate(OutDate.DATE,"%dd/%mm/%yyyy"),"%yyyy%mm%dd").

This variable sv2 is mapped to output Date column.

I am unable to find out the error.Please suggest me to resolve the warnings.
phanee_k
Charter Member
Charter Member
Posts: 68
Joined: Thu Nov 20, 2003 11:02 pm

Post by phanee_k »

StringToDate function converts the date into yyyy-mm-dd.

Why do you need the function.

DateToString(StringToDate(OutDate.DATE,"%dd/%mm/%yyyy"),"%yyyy%mm%dd").

Please check the datatype of sv2. You might be assigning Date to a Integer datatype stage variable.


Thanks
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

Did anyone faced this problem
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

phanee_k already pointed out your error. Check your datatype for sv2; it is an integer (or date) and you are assigning a string to it.
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

its an integer data type
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

I created a dummy job taking only Date field and converted the input date field from dd/mm/yyyy to yyyymmdd using the below function

DateToString(StringToDate(DSLink3.Date,"%dd/%mm/%yyyy"),"%yyyy%mm%dd")

Iam getting the same warning .Input field Datatype is Char(10) and output is Int(10).

I am trying using different target Datatype but couldn't suppress the warnings.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What is OutDate.DATE defined as and with what precision?
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

Hi ArndW,

The outdate.Date is Char(10) and its output is int(8)
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

out.Date is char(10) and output column is integer (8)
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

I get this warning after I validate the date

I am using a stage variable to validate the date
sv1:IsValid("DATE", StringToDate(DSLink3.Date,"%dd/%mm/%yyyy") )

In the output column the derivation is

If (sv1= @FALSE) Then "-1" Else DateToString(StringToDate(DSLink3.Date,"%dd/%mm/%yyyy"),"%yyyy%mm%dd")

If invalid then -1 else yyyymmdd format.

When I get an invalid date then I am getting the warning

Conversion error calling conversion routine date_from_string data may have been lost

Can anyone suggest me what is the error and how to supress the warnings
rafidwh
Participant
Posts: 179
Joined: Mon Oct 10, 2005 11:30 pm

Post by rafidwh »

Hi Gurus,

Do you have any idea to suppress these warnings.
What might be the cause for it.
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

How are you handling the null values?
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
Post Reply