Powerbuilder Numeric data types...

Hi,

I have seen several threads on this topic but was unable to find something
that suites my needs.

We are doing some PB6.5 to PB9 conversions here.
There is a problem with decimal limit being 18digits...I guess it was bad in
PB6.5 and corrected later on.

I need to be able to represent the following number in some form and also be
able to do some arithmetic on it.

999,999,999,999,999,999,999,999.99

I have data coming into a function and I need do things like this.

dec ldc_26_2  = 999999999999999999999999.99  //of course this will not
work...

If aData > ldc_26_2 then
    Messagebox("Error", "Data not allowed")
End if

Obviously this doesn't work because of the overflow.
I tried to use double and real and they gave me unexpected results.

I cannot change the database side of things at all so any solution needs to
be with PB...

Any help will be appreciated.


0
Nick
5/4/2004 12:56:03 PM
sybase.powerbuilder.general 62418 articles. 18 followers. Follow

5 Replies
641 Views

Similar Articles

[PageSpeed] 15

Bring it back from the DB as a string, do your arithmetic on DB.

tdw
"Nick N." <nick.nishizaka@natexisblr.us> wrote in message
news:409792e0$1@forums-2-dub...
> Hi,
>
> I have seen several threads on this topic but was unable to find something
> that suites my needs.
>
> We are doing some PB6.5 to PB9 conversions here.
> There is a problem with decimal limit being 18digits...I guess it was bad
in
> PB6.5 and corrected later on.
>
> I need to be able to represent the following number in some form and also
be
> able to do some arithmetic on it.
>
> 999,999,999,999,999,999,999,999.99
>
> I have data coming into a function and I need do things like this.
>
> dec ldc_26_2  = 999999999999999999999999.99  //of course this will not
> work...
>
> If aData > ldc_26_2 then
>     Messagebox("Error", "Data not allowed")
> End if
>
> Obviously this doesn't work because of the overflow.
> I tried to use double and real and they gave me unexpected results.
>
> I cannot change the database side of things at all so any solution needs
to
> be with PB...
>
> Any help will be appreciated.
>
>


0
tdw
5/4/2004 1:00:23 PM
Like I said, I cannot change anything on the DB Side...unfortunately

<tdw> wrote in message news:409793e7$1@forums-1-dub...
> Bring it back from the DB as a string, do your arithmetic on DB.
>
> tdw
> "Nick N." <nick.nishizaka@natexisblr.us> wrote in message
> news:409792e0$1@forums-2-dub...
> > Hi,
> >
> > I have seen several threads on this topic but was unable to find
something
> > that suites my needs.
> >
> > We are doing some PB6.5 to PB9 conversions here.
> > There is a problem with decimal limit being 18digits...I guess it was
bad
> in
> > PB6.5 and corrected later on.
> >
> > I need to be able to represent the following number in some form and
also
> be
> > able to do some arithmetic on it.
> >
> > 999,999,999,999,999,999,999,999.99
> >
> > I have data coming into a function and I need do things like this.
> >
> > dec ldc_26_2  = 999999999999999999999999.99  //of course this will not
> > work...
> >
> > If aData > ldc_26_2 then
> >     Messagebox("Error", "Data not allowed")
> > End if
> >
> > Obviously this doesn't work because of the overflow.
> > I tried to use double and real and they gave me unexpected results.
> >
> > I cannot change the database side of things at all so any solution needs
> to
> > be with PB...
> >
> > Any help will be appreciated.
> >
> >
>
>


0
Nick
5/4/2004 1:16:04 PM
The process of dealing with the "special case" of all 9's is easy enough by
using a "case" or "if" comparision in the select cause.

    something like:
    case MyValue when 9999999999999999.99 THEN 1
        else 0
    end flag_value,
    case MyValue when 9999999999999999.99 THEN 999999999.99
        else MyValue
    end MyValue

The potentially bigger issue is returning the normal values.  If they work
then you should be home free after some minor SQL changes.

"Nick N." <nick.nishizaka@natexisblr.us> wrote in message
news:40979792$1@forums-2-dub...
> Like I said, I cannot change anything on the DB Side...unfortunately
>
> <tdw> wrote in message news:409793e7$1@forums-1-dub...
> > Bring it back from the DB as a string, do your arithmetic on DB.
> >
> > tdw
> > "Nick N." <nick.nishizaka@natexisblr.us> wrote in message
> > news:409792e0$1@forums-2-dub...
> > > Hi,
> > >
> > > I have seen several threads on this topic but was unable to find
> something
> > > that suites my needs.
> > >
> > > We are doing some PB6.5 to PB9 conversions here.
> > > There is a problem with decimal limit being 18digits...I guess it was
> bad
> > in
> > > PB6.5 and corrected later on.
> > >
> > > I need to be able to represent the following number in some form and
> also
> > be
> > > able to do some arithmetic on it.
> > >
> > > 999,999,999,999,999,999,999,999.99
> > >
> > > I have data coming into a function and I need do things like this.
> > >
> > > dec ldc_26_2  = 999999999999999999999999.99  //of course this will not
> > > work...
> > >
> > > If aData > ldc_26_2 then
> > >     Messagebox("Error", "Data not allowed")
> > > End if
> > >
> > > Obviously this doesn't work because of the overflow.
> > > I tried to use double and real and they gave me unexpected results.
> > >
> > > I cannot change the database side of things at all so any solution
needs
> > to
> > > be with PB...
> > >
> > > Any help will be appreciated.
> > >
> > >
> >
> >
>
>


0
Tyler
5/4/2004 2:13:14 PM
It doesn't involve a DB change. When retrieving, CAST () (at least
that's the ASA function) the big numeric column to a string data type;
when updating or inserting CAST() your PB-side string to a numeric
data type. It'd probably make things like datawindows a little harder
to use, but not impossible.

Good luck,

Terry [TeamSybase] and Sequel the techno-kitten

On 4 May 2004 06:16:04 -0700, "Nick N." <nick.nishizaka@natexisblr.us>
wrote:

>Like I said, I cannot change anything on the DB Side...unfortunately
>
><tdw> wrote in message news:409793e7$1@forums-1-dub...
>> Bring it back from the DB as a string, do your arithmetic on DB.
>>
>> tdw
>> "Nick N." <nick.nishizaka@natexisblr.us> wrote in message
>> news:409792e0$1@forums-2-dub...
>> > Hi,
>> >
>> > I have seen several threads on this topic but was unable to find
>something
>> > that suites my needs.
>> >
>> > We are doing some PB6.5 to PB9 conversions here.
>> > There is a problem with decimal limit being 18digits...I guess it was
>bad
>> in
>> > PB6.5 and corrected later on.
>> >
>> > I need to be able to represent the following number in some form and
>also
>> be
>> > able to do some arithmetic on it.
>> >
>> > 999,999,999,999,999,999,999,999.99
>> >
>> > I have data coming into a function and I need do things like this.
>> >
>> > dec ldc_26_2  = 999999999999999999999999.99  //of course this will not
>> > work...
>> >
>> > If aData > ldc_26_2 then
>> >     Messagebox("Error", "Data not allowed")
>> > End if
>> >
>> > Obviously this doesn't work because of the overflow.
>> > I tried to use double and real and they gave me unexpected results.
>> >
>> > I cannot change the database side of things at all so any solution needs
>> to
>> > be with PB...
>> >
>> > Any help will be appreciated.

Sequel's Sandbox: http://www.techno-kitten.com
Home of PBL Peeper, a free PowerBuilder Developer's Toolkit. 
Version 2.2.06 now available at the Sandbox
See the PB Troubleshooting Guide at the Sandbox
^ ^
o o
=*=
0
Terry
5/4/2004 2:24:40 PM
Is using 999999999999999999999.99 in this manner different than assigning it
to a variable?
I'm wondering how it does comparisons in the background as in:

If myValue > 99999999999999999999.99 then
    Messagebox("Message", "value is too big")
end if

Does it convert the number in the background to a type?

In Excel I cannot get an accurate representation of
999999999999999999999999999.99 either...it cuts off several of te 9's and
put 0's in its place.


"Tyler Cruse" <tcruse@trlx.com> wrote in message
news:4097a4fa$1@forums-1-dub...
> The process of dealing with the "special case" of all 9's is easy enough
by
> using a "case" or "if" comparision in the select cause.
>
>     something like:
>     case MyValue when 9999999999999999.99 THEN 1
>         else 0
>     end flag_value,
>     case MyValue when 9999999999999999.99 THEN 999999999.99
>         else MyValue
>     end MyValue
>
> The potentially bigger issue is returning the normal values.  If they work
> then you should be home free after some minor SQL changes.
>
> "Nick N." <nick.nishizaka@natexisblr.us> wrote in message
> news:40979792$1@forums-2-dub...
> > Like I said, I cannot change anything on the DB Side...unfortunately
> >
> > <tdw> wrote in message news:409793e7$1@forums-1-dub...
> > > Bring it back from the DB as a string, do your arithmetic on DB.
> > >
> > > tdw
> > > "Nick N." <nick.nishizaka@natexisblr.us> wrote in message
> > > news:409792e0$1@forums-2-dub...
> > > > Hi,
> > > >
> > > > I have seen several threads on this topic but was unable to find
> > something
> > > > that suites my needs.
> > > >
> > > > We are doing some PB6.5 to PB9 conversions here.
> > > > There is a problem with decimal limit being 18digits...I guess it
was
> > bad
> > > in
> > > > PB6.5 and corrected later on.
> > > >
> > > > I need to be able to represent the following number in some form and
> > also
> > > be
> > > > able to do some arithmetic on it.
> > > >
> > > > 999,999,999,999,999,999,999,999.99
> > > >
> > > > I have data coming into a function and I need do things like this.
> > > >
> > > > dec ldc_26_2  = 999999999999999999999999.99  //of course this will
not
> > > > work...
> > > >
> > > > If aData > ldc_26_2 then
> > > >     Messagebox("Error", "Data not allowed")
> > > > End if
> > > >
> > > > Obviously this doesn't work because of the overflow.
> > > > I tried to use double and real and they gave me unexpected results.
> > > >
> > > > I cannot change the database side of things at all so any solution
> needs
> > > to
> > > > be with PB...
> > > >
> > > > Any help will be appreciated.
> > > >
> > > >
> > >
> > >
> >
> >
>
>


0
Nick
5/4/2004 3:14:08 PM
Reply: