handling decimals

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
pp
Participant
Posts: 27
Joined: Tue Apr 03, 2007 8:50 pm

handling decimals

Post 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.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Re: handling decimals

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
pp
Participant
Posts: 27
Joined: Tue Apr 03, 2007 8:50 pm

Post 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?
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

where are you storing these value in a DB or flat file?
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
pp
Participant
Posts: 27
Joined: Tue Apr 03, 2007 8:50 pm

Post by pp »

flat file
Madhusv
Participant
Posts: 35
Joined: Sat May 07, 2005 1:38 am
Contact:

Post by Madhusv »

What are stages you are using in this job?
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post 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.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply