decimal_from_string warning for same data length

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
adityavarma
Premium Member
Premium Member
Posts: 104
Joined: Thu Jul 12, 2007 11:32 pm
Location: Canada

decimal_from_string warning for same data length

Post by adityavarma »

I am converting a Varchar to Decimal and it is throwing the below error:

Conversion error calling conversion routine decimal_from_string data may have been lost

Source Datatype: Varchar 10
Target Datatype: Decimal (10,0)

I am using an existing Dataset (In Production) which has a datatype of Varchar(10) as source and writing into Netezza database.
I tried increasing the length of the Varchar fields in a transformer to Varchar 12 and then write into the Decimal(10,0) but i still get the same warnings

I want to get rid of the warnings without using the Message handler
can you please suggest ?




Thanks,
Aditya
Thanks
Aditya Kutcharlapati
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

I'm going to guess that you're doing a default implicit conversion. Implicit conversions will frequently generate a warning message (harmless and preventable). Using an explicit conversion will usually eliminate the warning.

Please post your transformer expression.

Mike
Thomas.B
Participant
Posts: 63
Joined: Thu Apr 09, 2015 6:40 am
Location: France - Nantes

Post by Thomas.B »

You can also use the Modify stage to do the conversion operation and use the NOWARN specification since the string to decimal conversion seems to be handled by DataStage :
https://www-01.ibm.com/support/knowledg ... sions.html

Ex :

Code: Select all

DEC01:decimal[10,0] = STR01
BI Consultant
DSXConsult
adityavarma
Premium Member
Premium Member
Posts: 104
Joined: Thu Jul 12, 2007 11:32 pm
Location: Canada

Post by adityavarma »

Mike,

Thank you for the reply.

I am using the below conversion function in the transformer stage

Code: Select all

StringToDecimal(trim(fromLkp.master_cust_number))
Thomas,

Thank you, i will use the modify stage and let you know

Thanks,
Aditya
Thanks
Aditya Kutcharlapati
adityavarma
Premium Member
Premium Member
Posts: 104
Joined: Thu Jul 12, 2007 11:32 pm
Location: Canada

Post by adityavarma »

Thank you Thomas .. it worked

I used the below specifications in Modify stage and the job completed successfully without warnings

Code: Select all

Specification = cust_num:decimal[10,0] = decimal_from_string(cust_num)
Specification = NOWARN
Last edited by adityavarma on Mon Nov 23, 2015 2:26 pm, edited 9 times in total.
Thanks
Aditya Kutcharlapati
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:idea: You can't use BBCode and then disable it at the same time. Okay, technically you can but what's the point? I fixed your previous post but not this most recent one so you can see the difference.
-craig

"You can never have too many knives" -- Logan Nine Fingers
adityavarma
Premium Member
Premium Member
Posts: 104
Joined: Thu Jul 12, 2007 11:32 pm
Location: Canada

Post by adityavarma »

Thank you Craig,

My bad, i ignored the check boxes
Thanks
Aditya Kutcharlapati
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Thanks, appreciate that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I had the thought that maybe they (IBM) could put something like NOWARN into the properties of the Transformer stage, but my second, better, thought was that that would lead to too much lazy programming.
Last edited by ray.wurlod on Wed Nov 25, 2015 2:57 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

StringToDecimal is an explicit type conversion function for the transformer stage, so it won't generate a warning in going from varchar(10) to decimal(10,0) if your source string is nothing but numeric digits.

Did you isolate a specific example row that causes a warning?

Using NOWARN is likely masking a source data quality issue.

Your transformer expression with a simple Trim function isn't adequate to handle bad source data.

Mike
Post Reply