'fix_zero' for decimal values

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
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

'fix_zero' for decimal values

Post by dspxlearn »

Hi,


In the datastage help, for decimaltostring function it is given that,

Code: Select all

'fix_zero'

By default decimal numbers comprising all zeros are treated as invalid. If the string fix_zero is specified as a second argument, then all zero decimal values are regarded as valid.
But in my case i have some decimal values which are of decimal(5,2).
For some records, i was getting 000.00 from the source which are being populated to the target(of varchar) without using the decimaltostring function..And they are being validated....

Is there any situation to use this function instead....
Thanks and Regards!!
dspxlearn
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Hi,


Continuation to the previous post i was getting a space leading to each record...What might be the reson for this.. :oops:
Thanks and Regards!!
dspxlearn
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Are you doing this function in a Modify stage or in a Transformer stage?

The leading space is for the sign.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dspxlearn
Premium Member
Premium Member
Posts: 291
Joined: Sat Sep 10, 2005 1:26 am

Post by dspxlearn »

Hi ray.wurlod,


I am using this function in a Transformer to which some decimal field weer coming..When i am passing them to the target file , i am getting those leading spaces...So, i was giving Trim function in the Transformer derivation..But, i also tried using Fabs before...Both were working fine...So, i continued giving Trim as i was not aware of that the spaces are for the sign :idea: ...I got replace that with Fabs back.....

I was using DecimalToSting(Fabs(col),'fix_zero,supress_zeros')

So, what is the use of 'fix_zeros'... :cry:
Thanks and Regards!!
dspxlearn
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Right now I am in an airport lounge and cannot check, but I believe you can read about this in the Orchestrate Operators manual.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

fix_zero causes a decimal field containing all zeros to be treated as a valid zero.

Omitting fix_zero causes the application to generate an error if it encounters a deimal containing all zeros.

suppress_zero specifies that the returned ustring value will have no leading or trailing zeros.
Examples. 000.100 -> 0.1; 001.00 -> 1; -001.100 -> -1.1

I don't know how you prevent the space other then trimming it off if it is a positive value.
Post Reply