Page 1 of 1

Conversion error

Posted: Tue Apr 24, 2012 10:42 pm
by nveejas
My source is a fixed width file. In that i have a field with value as 000012345.00 in source. In the target it is decimal. so when i try to convert it to decimal with stringToDecimal function i'm getting the following warning and also in target the value is convrted as 000000.00,

APT_CombinedOperatorController,0:Conversion error calling conversion routine decimal_from_string data may have been lost

Please give me some suggestions inorder to get correct value in the output without any warnings.
Note: Source daatype- char(12)
Target datatype - decimal(9,2)

Re: Conversion error

Posted: Tue Apr 24, 2012 11:11 pm
by SURA
Hence the source is char it may have space. Change the data type as VC as well as use ' ','A' in the TRIM function.

Posted: Wed Apr 25, 2012 1:48 am
by pandeesh
But i believe, there may not be any space, since his data is exactly 12 character long 000012345.00

Posted: Wed Apr 25, 2012 2:52 am
by ray.wurlod
Given your data types this is a spurious error ("they" are being over-cautious). Use a message handler to demote it.

Posted: Wed Apr 25, 2012 4:06 am
by nveejas
Hi Ray,

I can demote it but the value populated in targer is not correct. It is converted to 0000000.00 (total 9 zeros) and also as pandeesh said the lenght is exactly 12 charactes.

Posted: Wed Apr 25, 2012 4:20 pm
by qt_ky
You're losing data because 000012345.00 would require decimal(11,2) rather than 9,2.

Posted: Thu Apr 26, 2012 12:46 am
by nveejas
Hi Eric,

you are right..
Issue is solved..