Decimal to String 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
jayantthakore
Participant
Posts: 42
Joined: Tue Jan 18, 2005 5:48 am

Decimal to String Conversion

Post 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.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post 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
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

DataStage does not interpret the values when you view it.

Check whether you are viewing the same file.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jayantthakore
Participant
Posts: 42
Joined: Tue Jan 18, 2005 5:48 am

Post 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..
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply