An additional space is prefixed for the decimal fields

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
kiranredz
Premium Member
Premium Member
Posts: 21
Joined: Wed Aug 06, 2008 8:34 am
Location: United States

An additional space is prefixed for the decimal fields

Post by kiranredz »

Hi all,

I have a strange problem in my datastage code.

I am reading data from an Oracle Enterprise stage. I have few fields which are defined as Number(38,10). In the DataStage code(oracle stage) these fields are defined as Decimal(8,2). So, i am casting these fields to Number(8,2) in the SQL query using - CAST(FieldName AS NUMBER(8,2)).
Now, when i am reading the data, i am able to see a space preceeding each value. For Ex: If the value for this field in Oracle is 8.75, its read in DS Oracle Ent stage as " 000008.75". And my target data also has this space.

How can i avoid this? Please share with me the soultion if you have.

Thanks,
Kiran
Kiran
vasa_dxx
Participant
Posts: 39
Joined: Sun Sep 28, 2008 2:59 am
Contact:

Post by vasa_dxx »

Please post the Job design. So that one can find the options in the stages used in job or can suggest a new o be included.
You can rectify it by using trimB() to trim spaces in transformer.
Two wrongs don't make a right. But three lefts do.
vasa_dxx
Participant
Posts: 39
Joined: Sun Sep 28, 2008 2:59 am
Contact:

Post by vasa_dxx »

have a look at this post for more details.
viewtopic.php?t=124275
Two wrongs don't make a right. But three lefts do.
kiranredz
Premium Member
Premium Member
Posts: 21
Joined: Wed Aug 06, 2008 8:34 am
Location: United States

Post by kiranredz »

vasa_dxx wrote:have a look at this post for more details.
viewtopic.php?t=124275
I found out the reason for that. That space is to display the sign of the number. If its a positive number, we have a space preceeding the number. Ex: 8.54 would be " 000008.54". If its a negative number, the number will be preceeded by a minus(-) sign. Ex: -8.54 would be "-000008.54"
Kiran
Post Reply