Page 1 of 1

Decimal fields with a space and a .

Posted: Thu Mar 06, 2014 12:51 pm
by danddmrs
When writing data to decimal fields with a parallel job the value is preceded by a space and ends with a '.'.

The second field is SQL Type: Decimal, Length: 3, Scale: 0
"B", 000.,"000"

What would cause this behavior?

Posted: Thu Mar 06, 2014 1:35 pm
by FranklinE
It's important to know if this is how it's displayed in View Data or how it's stored in the file when browsed or edited in NotePad or another text editor.

The displayed number will have two positions reserved, one for the sign and one for the decimal. Check your output format in the table definition, and perhaps edit the number to remove the space and decimal.

Posted: Thu Mar 06, 2014 2:14 pm
by danddmrs
The example above was copied from the .txt file in word pad.

Posted: Thu Mar 06, 2014 2:23 pm
by danddmrs
Column Meta Data

SQL type: Decimal
Length: 3
Scale: 0
Nullable: No
Description: <none> Seachable? N
Properties: Field level, Quote = none

Posted: Thu Mar 06, 2014 3:09 pm
by chulett
That's how it handles decimal values written to a file. If you want some other behaviour, define the output field as a string and use DecimalToString() to get it formatted however you need it.

reply

Posted: Thu Mar 06, 2014 4:11 pm
by ssnegi
This will remove the 0's and the space.
Trim(DecimalToString(DECIMALFIELD,"suppresszero") )

Posted: Thu Mar 06, 2014 4:15 pm
by danddmrs
Fair enough. Thanks for the information.

Reply

Posted: Thu Mar 06, 2014 4:22 pm
by ssnegi
Since the output field is scale 0 you could define it as integer and use function
AsInteger(DECIMALFIELD)