Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Odd Dec function behavior

3 posts in Powerscript Last posting was on 2010-02-12 14:35:31.0Z
Chris Kean Posted on 2010-02-11 21:09:16.0Z
From: "Chris Kean" <christopher.kean@stld-cci.com>
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: Odd Dec function behavior
Lines: 19
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3598
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b7471fc@forums-1-dub>
Date: 11 Feb 2010 13:09:16 -0800
X-Trace: forums-1-dub 1265922556 10.22.241.152 (11 Feb 2010 13:09:16 -0800)
X-Original-Trace: 11 Feb 2010 13:09:16 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27303
Article PK: 761801

Having an issue with the "Dec" function in PB 11.5.

We're converting apps from 10.5.2 to 11.5.1 build 4675.

We have a function that takes a blob and breaks it out into 4 byte
variables. The bytes are then converted to decimal values via the function
"Dec(byteval)" for a function that converts them to their hexadecimal
representation.

This worked in 10.5.2, but has stopped working right in 11.5.1. The problem
appears to be that Dec, instead of converting the byteval (e.g. 48) to just
a decimal representation of the same number (48.0) is for some reason
dividing by 100 (0.48). This isn't how Dec is supposed to work, is it?

Thanks,

Chris


Chris Kean Posted on 2010-02-12 14:35:31.0Z
From: "Chris Kean" <christopher.kean@stld-cci.com>
Newsgroups: sybase.public.powerbuilder.powerscript
References: <4b7471fc@forums-1-dub>
Subject: Re: Odd Dec function behavior
Lines: 46
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3598
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5512
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4b756733$1@forums-1-dub>
Date: 12 Feb 2010 06:35:31 -0800
X-Trace: forums-1-dub 1265985331 10.22.241.152 (12 Feb 2010 06:35:31 -0800)
X-Original-Trace: 12 Feb 2010 06:35:31 -0800, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27305
Article PK: 793679

I'll post it in both here and in .general, but an additional FYI here.

Implicit conversion from Byte to Decimal also has the issue, regardless of
using the Dec function.

So if the code is modified as such:
===
Byte lb_test
Decimal ld_test

lb_test = 48
*ld_test = lb_test

MessageBox("Test", String(ld_test))
===
The message box still returns "0.48" as the decimal string. I'd guess under
the hood, PB is just calling the Dec() function or the same basic code for
the conversion.

Thanks,

Chris

"Chris Kean" <christopher.kean@stld-cci.com> wrote in message
news:4b7471fc@forums-1-dub...
> Having an issue with the "Dec" function in PB 11.5.
>
> We're converting apps from 10.5.2 to 11.5.1 build 4675.
>
> We have a function that takes a blob and breaks it out into 4 byte
> variables. The bytes are then converted to decimal values via the function
> "Dec(byteval)" for a function that converts them to their hexadecimal
> representation.
>
> This worked in 10.5.2, but has stopped working right in 11.5.1. The
> problem appears to be that Dec, instead of converting the byteval (e.g.
> 48) to just a decimal representation of the same number (48.0) is for some
> reason dividing by 100 (0.48). This isn't how Dec is supposed to work, is
> it?
>
> Thanks,
>
> Chris
>


Andreas Mykonios Posted on 2010-02-12 14:30:58.0Z
From: Andreas Mykonios <Andreas Mykonios>
Newsgroups: sybase.public.powerbuilder.powerscript
Subject: Re: Odd Dec function behavior
Message-ID: <e0pan593ssgabs7c6b6kcmddtgal4r3dif@4ax.com>
References: <4b7471fc@forums-1-dub>
X-Newsreader: Forte Agent 4.2/32.1118
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 12 Feb 2010 06:30:58 -0800
X-Trace: forums-1-dub 1265985058 10.22.241.152 (12 Feb 2010 06:30:58 -0800)
X-Original-Trace: 12 Feb 2010 06:30:58 -0800, vip152.sybase.com
Lines: 62
X-Authenticated-User: powerbuilder
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.powerscript:27304
Article PK: 793681

Hi Chris...

You are right about the problem. I obtain the same result in v. 11.2
also.

What I want to mention is that according to help files, dec function
get as argument string or blob. I think that this is maybe an
explanation. Of course if you convert your byte to string it will work
fine. The strange is that it works also with integers!

So when trying the following:

byte b1 = 40

messagebox("", dec(string(b1)))

it returns 40.

When trying:

byte b1 = 40

messagebox("", dec(integer(b1)))

it returns 40.

When trying:

byte b1 = 40

messagebox("", dec(b1))

it returns 0.40...


It's strange, but if documentation of dec function is correct then the
right way is to write messagebox("", dec(string(b1)))...


Andreas Mykonios.

On 11 Feb 2010 13:09:16 -0800, "Chris Kean"

<christopher.kean@stld-cci.com> wrote:

>Having an issue with the "Dec" function in PB 11.5.
>
>We're converting apps from 10.5.2 to 11.5.1 build 4675.
>
>We have a function that takes a blob and breaks it out into 4 byte
>variables. The bytes are then converted to decimal values via the function
>"Dec(byteval)" for a function that converts them to their hexadecimal
>representation.
>
>This worked in 10.5.2, but has stopped working right in 11.5.1. The problem
>appears to be that Dec, instead of converting the byteval (e.g. 48) to just
>a decimal representation of the same number (48.0) is for some reason
>dividing by 100 (0.48). This isn't how Dec is supposed to work, is it?
>
>Thanks,
>
>Chris
>