Page 1 of 1

handling decimals

Posted: Tue Apr 03, 2007 9:12 pm
by pp
How can I remove/trim off the space in my output data (which is of decimal datatype) which is added by Datastage.

For eg. my input schema is:
name string(3);
account string(5);

And input data is:
asd23456qwe98765

In my ouptut I get a blank space in front of the decimal datatype:

Schema for output file:
name string(3);
account decimal(5);

Data as I get in my output file is:
asd 23456qwe 98765

How can I trim/remove the space in front of this decimal data(account)?
Is it so that datastage adds this space for a signed value ?

Thanks.

Re: handling decimals

Posted: Tue Apr 03, 2007 9:17 pm
by DSguru2B
pp wrote:Is it so that datastage adds this space for a signed value ?
Welcome Aboard :)
There you go, you have the answer right there. If you have to trim the space you need to convert it to varchar using DecimalToString() and then apply the trim to it.

Posted: Wed Apr 04, 2007 11:58 am
by pp
I cannot add any functionality in there to trim off the space as we are using dynamic layouts and we dont want to have any hardcoded functionality in there.

I was wondering if we could use any of the decimal properties such as overpunched, packed, unpacked, etc., which could do the job.

Do you think it can be handled like that?

Posted: Wed Apr 04, 2007 2:15 pm
by us1aslam1us
where are you storing these value in a DB or flat file?

Posted: Wed Apr 04, 2007 3:23 pm
by pp
flat file

Posted: Wed Apr 04, 2007 4:26 pm
by Madhusv
What are stages you are using in this job?

Posted: Wed Apr 04, 2007 5:05 pm
by DSguru2B
Decimal by property will save the leading space. So you will have to process it somehow, somewhere to get rid of it. Unless you explicitly change the data type and trim the space.