Problem converting String to Decimal

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
sshettar
Premium Member
Premium Member
Posts: 264
Joined: Thu Nov 30, 2006 10:37 am

Problem converting String to Decimal

Post by sshettar »

Hi All,

I have this file which has a field of type char(8) . i need to convert this into decimal[7,2].

Well i am using stringtodecimal() funtion in the transformer right now .
It seems to work perfectly fine all most of the records and just in case if the filed had any value which could not be cnverted to a decimal then its putting out as 00000.00

The strange thing here is for 3 records this funvtion is throuwing 00000.00 values after conversion .
but the data seems to be right for conversion into a decimal .

The values as as below

-005500 |ABC |
0303030 |1DFG2001 |
0205505 | |
0105516 | |

Of these two filed the feild i'm looking at is the first field which has to be converted into decimal.

our job is able to read the first record properly as a decimal value as
-05500.00 but not the rest of the records as its throwing in 00000.00 value for the rest

ANy help on this is highly appreciated
ambasta
Participant
Posts: 93
Joined: Thu Jan 19, 2006 10:29 pm
Location: Bangalore

Post by ambasta »

You have defined your source metadata as Char[8] ,but i can see the data is only of 7 digits..is the last digit a null or space..if it is... then you will not be able to convert it into decimal...
Change the source metadata to varchar and then try..
ambasta
Post Reply