don't want to round a string to decimal

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
getsatish_gk
Participant
Posts: 104
Joined: Sat Dec 24, 2005 1:26 am
Location: Bengaluru

don't want to round a string to decimal

Post by getsatish_gk »

Inputstring=5.9999999999999999999
expectoutoput(decimal,26,8)=5.99999999

but i am getting 6.00000000 (decimal,26,8)

how to acevied this ia m using stringtodecimal

Please help
getsatish_gk
Participant
Posts: 104
Joined: Sat Dec 24, 2005 1:26 am
Location: Bengaluru

Post by getsatish_gk »

Basically i don't want to round the input value.
Is there any environment variable to disable?
[quote][/quote]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There are four rtype arguments you can use with decimal processing; ceil, floor, round_inf and trunc_zero. The default is trunc_zero.

Read about them in Appendix B of the Parallel Job Developer's Guide for more information.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
AmeyJoshi14
Participant
Posts: 334
Joined: Fri Dec 01, 2006 5:17 am
Location: Texas

Post by AmeyJoshi14 »

Hi,
I am not able to recollect the exact parameter name but i think it is:
APT_DECIMAL_INTER_ROUND_MODE... :oops: or
APT_DEC_INTERM_ROUND_MODE

You can check the variable :
APT_DECIMAL_INTER_ROUND_MODE=None.

I am not able to check the result since right now i do not have the acess to DS.
Hope this will help you out! :wink:
http://findingjobsindatastage.blogspot.com/
Theory is when you know all and nothing works. Practice is when all works and nobody knows why. In this case we have put together theory and practice: nothing works. and nobody knows why! (Albert Einstein)
getsatish_gk
Participant
Posts: 104
Joined: Sat Dec 24, 2005 1:26 am
Location: Bengaluru

Post by getsatish_gk »

Hi there, Thanks for possible solutions,

Sol1:
I can applied APT_DECIMAL_INTERM_PRICISION TO NONE
-But the same results. :cry:

Sol2:
i know there are ceil,floor, round_inf and trunc_zero(default)
-But all there are meant to say how to round the input value. :oops:

But i don't want to round the input

input(varchar300)=5.99999999999
expected output(Decimal26,8)=5.99999999 but its rounding to 6.00000000
:?: :?:
getsatish_gk
Participant
Posts: 104
Joined: Sat Dec 24, 2005 1:26 am
Location: Bengaluru

Post by getsatish_gk »

By now with several experiements i am using :o

AsDouble(Input) or DfloatToDecimal(AsDouble(pTest))
These would still round but to very less extend

Any other trick would help. 8)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Did you try floor as the rtype?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
getsatish_gk
Participant
Posts: 104
Joined: Sat Dec 24, 2005 1:26 am
Location: Bengaluru

Post by getsatish_gk »

Thanks Ray,

'floor' option has solved one requirement i.e for not to round the values

but this will not cater for exponential values.
inputvalves=5.99999999999 and 9.9999999999999995e-07

using StringToDecimal(inputvalues,'floor') does not work for expo values

as a test job i am handling expo values as AsDouble(inputvalues)

Please advice to handle for both types in inputs.

Thanks in advance
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Keep experimenting. Curiously enough, we don't know all the answers. There are known unknowns, and there are unknown unknowns.

Post your results.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
getsatish_gk
Participant
Posts: 104
Joined: Sat Dec 24, 2005 1:26 am
Location: Bengaluru

Post by getsatish_gk »

Well.
This works DfloatToDecimal(AsDouble(Input))
even for exponential values. :wink:

But still does some minor rounding

Thanks
Post Reply