Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

VMS Basic and quad by value

142 views
Skip to first unread message

Arne Vajhøj

unread,
Sep 23, 2022, 4:37:44 PM9/23/22
to
I am not good at Basic so I may be missing something obvious.

As I read the manual then I should be able to pass a quad by value.

But the compiler disagrees.

Can anybody shed some light on this?

Arne

Bill Gunshannon

unread,
Sep 23, 2022, 4:45:59 PM9/23/22
to
Can you show us the code?

bill


Arne Vajhøj

unread,
Sep 23, 2022, 6:45:41 PM9/23/22
to
Sure.

$ type z1.bas
program z1

declare quad v

v = 123
call f(v)

end program
!

sub f(quad a by value)

print a

end sub
$ bas z1

sub f(quad a by value)
...............^
%BASIC-E-NOTRECVBY, A may not be received BY VALUE
at line number 11 in file DISK2:[ARNE.ipc.redis]z1.bas;7
%BASIC-E-ENDNOOBJ, DISK2:[ARNE.ipc.redis]z1.bas;7 completed with 1
diagnostic - object deleted

and the manual says:

<quote>
You can pass BYTE, WORD, LONG, QUAD, DOUBLE, GFLOAT, SINGLE,
SFLOAT, and TFLOAT values by value.
</quote>

This is on Alpha. There would be an obvious problem on VAX.

Arne



Dave Froble

unread,
Sep 23, 2022, 9:09:24 PM9/23/22
to
On 9/23/2022 6:45 PM, Arne Vajhøj wrote:
> On 9/23/2022 4:45 PM, Bill Gunshannon wrote:
>> On 9/23/22 16:37, Arne Vajhøj wrote:
>>> I am not good at Basic so I may be missing something obvious.
>>>
>>> As I read the manual then I should be able to pass a quad by value.
>>>
>>> But the compiler disagrees.
>>>
>>> Can anybody shed some light on this?
>>>
>>
>> Can you show us the code?
>
> Sure.
>
> $ type z1.bas
> program z1
>
> declare quad v
>
> v = 123
> call f(v)

You do realize, I hope, that you are passing the variable by reference?

> end program
> !
>
> sub f(quad a by value)

I tried this. It appears that Basic does not allow an argument to be declared
QUAD and received By Value. I'd consider this a bug.

However, to demonstrate:

AS800> t z5.bas,z6.bas
1 ! Program Z5

Declare Quad Q

Q = 123
Call Z6( Q )
Print Q

End

SYS$SYSDEVICE:[DFE]Z6.BAS;4

1 ! Program Z6

Sub Z6( Long L By Value )

Print L

End Sub
AS800> run z5
2061851336
123
AS800>

As expected, the value of the argument is the address of the quadword variable
in program Z5.

> print a
>
> end sub
> $ bas z1
>
> sub f(quad a by value)
> ...............^
> %BASIC-E-NOTRECVBY, A may not be received BY VALUE
> at line number 11 in file DISK2:[ARNE.ipc.redis]z1.bas;7
> %BASIC-E-ENDNOOBJ, DISK2:[ARNE.ipc.redis]z1.bas;7 completed with 1 diagnostic -
> object deleted
>
> and the manual says:
>
> <quote>
> You can pass BYTE, WORD, LONG, QUAD, DOUBLE, GFLOAT, SINGLE,
> SFLOAT, and TFLOAT values by value.
> </quote>
>
> This is on Alpha. There would be an obvious problem on VAX.
>
> Arne
>
>
>


--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: da...@tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486

Dave Froble

unread,
Sep 23, 2022, 9:18:20 PM9/23/22
to
>> This is on Alpha. There would be an obvious problem on VAX.

As a follow up, my test was using Alpha BASIC V1.7-000

I believe there are later versions of Basic.

I tried the test on VAX, and the Basic on the VAX, VAX BASIC V3.8-000, didn't
seem to like Quad data types. As expected.

Neil Rieck

unread,
Sep 24, 2022, 6:23:52 AM9/24/22
to
I have written "a lot" of BASIC programs for VMS and OpenVMS systems since 1987 and published many demos here:
https://neilrieck.net/demo_vms_html/openvms_demo_index.html
and have saved some recent BASIC manuals here:
https://neilrieck.net/misc/pdf/vms-docs/

IIRC, the QUAD data type was added to BASIC for the port from VAX to Alpha and it appears that it was not implemented fully or properly tested by Compaq. To make matters worse, many broken items were not fixed by HP for the port to Itanium. Some of the problems with BASIC-1.7 (see first link) were fixed by HP then sent to me as private patches but were never put into production for other customers. As I understand it, all my problems with the compiler and BASRTL have all been fixed in the VSI branded products so customers still working in the OpenVMS ecosystem need to move to VSI ASAP.

A good argument could be made about passing "a byte or word by value" being more efficient than "by ref" and we thought a lot that way on VAX. But anything larger than an address (includes a QUAD) would be passed more efficiently by ref. More than 5 years ago I had to jump through a few hoops in order to interface VMS-BASIC with C (or C-API) in order to connect BASIC with TCP/IP and MySQL/MariaDB client. In order to do build them I wrote these passing demos but do not recall ever passing anything by value.

https://neilrieck.net/demo_vms_html/openvms_demo_index.html#hybrid-demo-1

Neil Rieck
Waterloo, Ontario, Canada.
http://neilrieck.net

Arne Vajhøj

unread,
Sep 24, 2022, 6:57:56 PM9/24/22
to
On 9/23/2022 9:09 PM, Dave Froble wrote:
> On 9/23/2022 6:45 PM, Arne Vajhøj wrote:
>> On 9/23/2022 4:45 PM, Bill Gunshannon wrote:
>>> On 9/23/22 16:37, Arne Vajhøj wrote:
>>>> I am not good at Basic so I may be missing something obvious.
>>>>
>>>> As I read the manual then I should be able to pass a quad by value.
>>>>
>>>> But the compiler disagrees.
>>>>
>>>> Can anybody shed some light on this?
>>>>
>>>
>>> Can you show us the code?
>>
>> Sure.
>>
>> $ type z1.bas
>> program z1
>>
>> declare quad v
>>
>> v = 123
>> call f(v)
>
> You do realize, I hope, that you are passing the variable by reference?

No. I don't.

:-)

>> end program
>> !
>>
>> sub f(quad a by value)
>
> I tried this.  It appears that Basic does not allow an argument to be
> declared QUAD and received By Value.  I'd consider this a bug.

Given that the docs claims it should work, then it must
be a bug.

And I believe the compiler should be fixed not the documentation,
because on Alpha, Itanium and x86-64 there is no reason not to
allow it.


> However, to demonstrate:
>
> AS800> t z5.bas,z6.bas
> 1       ! Program Z5
>
>         Declare Quad Q
>
>         Q = 123
>         Call Z6( Q )
>         Print Q
>
> End
>
> SYS$SYSDEVICE:[DFE]Z6.BAS;4
>
> 1       ! Program Z6
>
>         Sub Z6( Long L By Value )
>
>         Print L
>
>         End Sub
> AS800> run z5
>  2061851336
>  123
> AS800>
>
> As expected, the value of the argument is the address of the quadword
> variable in program Z5.

Two compilation units. I only had one.

It seems to work with long.

$ typ z2.bas
program z2

declare quad v

v = 123
call f(v)

end program
!

sub f(quad a)

print a

end sub
$ bas z2
$ lin z2
$ r z2
123

Apparently the Basic compiler do look ahead in the compilation unit.

Arne




Arne Vajhøj

unread,
Sep 24, 2022, 7:04:26 PM9/24/22
to
On 9/24/2022 6:23 AM, Neil Rieck wrote:
> On Friday, September 23, 2022 at 4:37:44 PM UTC-4, Arne Vajhøj
> wrote:
>> I am not good at Basic so I may be missing something obvious.
>>
>> As I read the manual then I should be able to pass a quad by
>> value.
>>
>> But the compiler disagrees.
>>
>> Can anybody shed some light on this?
>
> I have written "a lot" of BASIC programs for VMS and OpenVMS systems
> since 1987 and published many demos here:
> https://neilrieck.net/demo_vms_html/openvms_demo_index.html and have
> saved some recent BASIC manuals here:
> https://neilrieck.net/misc/pdf/vms-docs/
>
> IIRC, the QUAD data type was added to BASIC for the port from VAX to
> Alpha and it appears that it was not implemented fully or properly
> tested by Compaq. To make matters worse, many broken items were not
> fixed by HP for the port to Itanium. Some of the problems with
> BASIC-1.7 (see first link) were fixed by HP then sent to me as
> private patches but were never put into production for other
> customers. As I understand it, all my problems with the compiler and
> BASRTL have all been fixed in the VSI branded products so customers
> still working in the OpenVMS ecosystem need to move to VSI ASAP.

I am testing with VSI Basic 1.8.

I will just conclude that quad by value is not supported
for now.

Arne



Dave Froble

unread,
Sep 24, 2022, 7:53:59 PM9/24/22
to
I never do that ...

> It seems to work with long.
>
> $ typ z2.bas
> program z2
>
> declare quad v
>
> v = 123
> call f(v)
>
> end program
> !
>
> sub f(quad a)
>
> print a
>
> end sub
> $ bas z2
> $ lin z2
> $ r z2
> 123
>
> Apparently the Basic compiler do look ahead in the compilation unit.

I doubt that. Note that in this last example, you did not attempt to declare
the argument in the sub statement to be declared by value.

Arne Vajhøj

unread,
Sep 24, 2022, 8:21:56 PM9/24/22
to
On 9/24/2022 7:54 PM, Dave Froble wrote:
> On 9/24/2022 6:57 PM, Arne Vajhøj wrote:
>> Two compilation units. I only had one.
>
> I never do that ...

I never do Basic os ...

>> It seems to work with long.
>>
>> $ typ z2.bas
>> program z2
>>
>> declare quad v
>>
>> v = 123
>> call f(v)
>>
>> end program
>> !
>>
>> sub f(quad a)
>>
>>     print a
>>
>> end sub
>> $ bas z2
>> $ lin z2
>> $ r z2
>>  123
>>
>> Apparently the Basic compiler do look ahead in the compilation unit.
>
> I doubt that.  Note that in this last example, you did not attempt to
> declare the argument in the sub statement to be declared by value.

Ooops.

That was a quad default mechanism example not a long example.

I messed up. You are right - it needs to be declared.

Arne





Neil Rieck

unread,
Sep 28, 2022, 11:47:14 AM9/28/22
to
Quick question about VSI BASIC 1.8

Could you verify if the QUAD and DECIMAL bugs I flagged here in BASIC 1.7 are fixed?
https://neilrieck.net/demo_vms_html/openvms_demo_index.html#basic-compiler-bugs

Also, please declare an array of QUAD then attempt to zero it (or do anything else) using one of the MAT commands.

Thanks

Richard Brodie

unread,
Sep 28, 2022, 12:11:07 PM9/28/22
to
On Wednesday, 28 September 2022 at 16:47:14 UTC+1, Neil Rieck wrote:

> Could you verify if the QUAD and DECIMAL bugs I flagged here in BASIC 1.7 are fixed?
> https://neilrieck.net/demo_vms_html/openvms_demo_index.html#basic-compiler-bugs

QUAD bug is fixed. DECIMAL warns about loss of precision but is not fixed.

> Also, please declare an array of QUAD then attempt to zero it (or do anything else) using one of the MAT commands.

Seems to work OK. Tested on Itanium.
0 new messages