Page 1 of 1

Space in decimal number

Posted: Thu Nov 15, 2012 11:36 pm
by raju4u
Hi all,

I am genarating fixed with file and that file contains 2 columns.

Uniq char(4),Amt decima(8,2)


Output file i am getting is :
aaaa 000001.12
bbbb 000011.23

Required Output should be without space:
aaaa000001.12
bbbb000011.23

The problem here is Before decemal coumn i am getting one extra space.
I need to remove that space bec this is a fixed with file.
I tried many option with Stripwhitrspace and Trim functions,but still it is not removing.
Here I should not convert it in to Char ,it should be Decimal only.
Please help me on this.

Posted: Fri Nov 16, 2012 12:43 am
by ray.wurlod
The space is the sign character. The only way you can lose it is to convert the data type to Char (or VarChar) and strip the white space.

Re: Space in decimal number

Posted: Fri Nov 16, 2012 8:31 am
by chulett
raju4u wrote:Here I should not convert it in to Char ,it should be Decimal only.
Yes, you should. Flat files are just character data after all. Of course, make sure you're still writing out a valid decimal value but as noted, convert it to a string so you have full control over the formatting.