Decimal fields with a space and a .

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
danddmrs
Premium Member
Premium Member
Posts: 86
Joined: Fri Apr 20, 2007 12:55 pm

Decimal fields with a space and a .

Post 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?
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post 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.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
danddmrs
Premium Member
Premium Member
Posts: 86
Joined: Fri Apr 20, 2007 12:55 pm

Post by danddmrs »

The example above was copied from the .txt file in word pad.
danddmrs
Premium Member
Premium Member
Posts: 86
Joined: Fri Apr 20, 2007 12:55 pm

Post by danddmrs »

Column Meta Data

SQL type: Decimal
Length: 3
Scale: 0
Nullable: No
Description: <none> Seachable? N
Properties: Field level, Quote = none
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ssnegi
Participant
Posts: 138
Joined: Thu Nov 15, 2007 4:17 am
Location: Sydney, Australia

reply

Post by ssnegi »

This will remove the 0's and the space.
Trim(DecimalToString(DECIMALFIELD,"suppresszero") )
danddmrs
Premium Member
Premium Member
Posts: 86
Joined: Fri Apr 20, 2007 12:55 pm

Post by danddmrs »

Fair enough. Thanks for the information.
ssnegi
Participant
Posts: 138
Joined: Thu Nov 15, 2007 4:17 am
Location: Sydney, Australia

Reply

Post by ssnegi »

Since the output field is scale 0 you could define it as integer and use function
AsInteger(DECIMALFIELD)
Post Reply