Conversion from Decimal to varchar

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
kalpanam
Participant
Posts: 39
Joined: Sat Apr 19, 2008 6:14 am

Conversion from Decimal to varchar

Post by kalpanam »

Hi,

I'm facing problem in converting Decimal(9,0) to Varchar(20).My design is as below:

DB2 stage------->Modify stage------>DB2 stage

In modify stage I have specified as INTERNET_ORDER_NBR=string_from_decimal (INTERNET_ORDER_NBR)

I'm getting output as
049351929.
049342258.
But the required output is

49351929
49342258

Can anyone help me how to get this result..

Thanks,
KalpanaM
Kalpana Marupudi
behrouz
Participant
Posts: 41
Joined: Tue Oct 28, 2008 4:13 am

Re: Conversion from Decimal to varchar

Post by behrouz »

if you get 0xxxx as your input link
you can transtype your decimal to integer then it will be like xxxx and then transtype it to string

the other option is do a simple maping by transformer do not use modify

Arash
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What you get and what you expect are equivalent. Decimal representation in DataStage includes leading and trailing non-significant zeroes and placeholder to prove that precision and scale are being managed correctly. You can remove each with Trim() functions or, if you are 100% certain that there are always eight significant digits, with substring operator.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kalpanam
Participant
Posts: 39
Joined: Sat Apr 19, 2008 6:14 am

Post by kalpanam »

ray.wurlod wrote:What you get and what you expect are equivalent. Decimal representation in DataStage includes leading and trailing non-significant zeroes and placeholder to prove that precision and scale are being m ...
no when I queried the DB2 table using IBM data studio 2.2,I'm getting the result displayed as

049351929.
049342258.

but the required output should be

49351929
49342258

Thanks & Regards,
Kalpana.
Kalpana Marupudi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Read all of my response.

Premium membership is not expensive, at less than 30c (Rs12) per day.
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