Page 1 of 1

Decimal to String Conversion

Posted: Mon Sep 12, 2005 7:53 am
by jayantthakore
Hii,
I have 3 decimal fields and all other are char fields.When i view it in unix it give garbage in all decimal field and other char fields are fine.When I view the file in Datastage Sequential File Stage I view all the records properly.I think the problem is in Decimal fields,So i put the DecimaltoString Convertor in the transformer.But then it fills all zeros in the decimal field and shows blank space when viewed in VI Editor.

Please tell me how to implement it So i conver Decimalto String without loosing Data.
Input is Decimal[15,2].Output can be a string of any length.

Posted: Mon Sep 12, 2005 8:24 am
by kumar_s
Hi,
May i know what sort of data you see in vi editor....
if you can able to see all records properly through datastage, then i hope u should not get any error.
Ensure the delimiter are set properly.
Can also try decimaltodecimal....

regards
kumar

Posted: Mon Sep 12, 2005 9:45 am
by Sainath.Srinivasan
DataStage does not interpret the values when you view it.

Check whether you are viewing the same file.

Posted: Mon Sep 12, 2005 3:44 pm
by ray.wurlod
View it with a hex editor and a companion who understands the rules for storage of decimal data types. You will find that it's not "garbage". So string_from_decimal (in a Modify stage) or DecimaltoString (in a Transformer stage) should do the job for you. Make sure that the string has sufficient characters to handle the biggest possible decimal number.

Posted: Mon Sep 12, 2005 10:12 pm
by jayantthakore
I am viewing the correct file.
The data I view is "^L?" for a field "23.4"..Delimiters are also in place to view it as a CSV.
I have tried the String to Decimal format.Can you give the complete format to be written.
Wat is the function used in a modify Stage??

Thanks for response..

Posted: Tue Sep 13, 2005 1:29 am
by ray.wurlod
You're not viewing with a hex editor, or you're not showing us the hex representation (which should be eight bytes long).

As to your question, you did not read my prior response very well:
string_from_decimal (in a Modify stage)