DecimalTochar 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
ajmore
Participant
Posts: 22
Joined: Fri Aug 25, 2006 5:25 am

DecimalTochar Conversion

Post by ajmore »

Hi all :)
I am using the transformer stage for converting decimal[9] to char[9].
i used the char(%number%) function but it does not provide any solution(also no warning or error msg. is their :roll: in log ) Then i used decimalTosting() function but this also does not provide me the solution..in fact it gives me the warning...
:!: APT_CombinedOperatorController,0: Conversion error calling conversion routine string_from_decimal data may have been lost

:idea: i also tried to used Modify stage.. it provide me the sol. but the output contains dots(i.e 037025735.) thus i am not able to use this data in join stage as the other dataset contains (037025735 data in char(9) format)thus join does not provide necessary result.......

Kindly Help me to resolve this issuse...
Thanks in advance...
bchau
Charter Member
Charter Member
Posts: 46
Joined: Tue Jan 18, 2005 7:39 am
Location: Japan
Contact:

Post by bchau »

Type Decimal fields will always has a byte for the sign and a byte for the decimal. So if you have Decimal[9,0] and it is a positive number your number will be like this: space+123456789+period

So what you want to do is trim the space and period.

Try Trim(Trim(DecimalToString(%num%,%option),'.'),' ')

The syntax may be incorrect as I don't have DS on this machine to confirm.
Post Reply