HP OpenVMS Systems Documentation |
HP BASIC for OpenVMS
|
Previous | Contents | Index |
In I64 BASIC/Alpha BASIC, unlike VAX BASIC, you cannot have duplicate line numbers or line numbers not in ascending numerical order. This restriction applies to single source files or source files concatenated with a plus sign (+) at the DCL command line. Duplicate line numbers or line numbers not in ascending order cause "E" level compilation errors.
VAX BASIC does allow duplicates and lines out of order. I64 BASIC/Alpha BASIC provides an example TPU command procedure to help work around this difference. It can be used to append source files and sort BASIC line numbers into ascending numerical order from one or more source files.
After installation of Alpha BASIC, the TPU command procedure is located in:
SYS$COMMON:[SYSHLP.EXAMPLES.BASIC]BASIC$ENV.TPU. |
Instructions for its use are in the file.
Although there are no known problems, the TPU command procedure has not been thoroughly tested. As a result, it is not supported by HP. |
To achieve the most efficient performance, the I64 BASIC/Alpha BASIC compiler may reorder the execution of arithmetic instructions. Rarely does this result in error handling semantics that are incompatible with VAX BASIC; most programs are not affected by this change.
Use the I64 BASIC/Alpha BASIC /SYNCHRONOUS_EXCEPTIONS qualifier
for those programs that require exact VAX BASIC behavior.
C.2.3.11 Generation of Object Modules
In I64 BASIC/Alpha BASIC, the default behavior places all
routines (SUBs, FUNCTIONs, and main programs) compiled within a single
source program into a single module in the object file. VAX BASIC
generates each routine as a separate module. Use the
I64 BASIC/Alpha BASIC /SEPARATE_COMPILATION qualifier to
duplicate VAX BASIC behavior. See the information on qualifiers on
the BASIC command line in the HP BASIC for OpenVMS User Manual.
C.2.3.12 RESUME and DEF
VAX BASIC does not enforce the documented restriction that a
RESUME statement lexically outside a DEF statement (without a target
specified) cannot resume program execution within a DEF statement.
I64 BASIC/Alpha BASIC enforces this restriction at run time.
C.2.3.13 Exceptions
When the I64 BASIC/Alpha BASIC compiler determines that the result of an expression is never used, the compiler does not generate code to evaluate that expression. This causes an incompatibility with VAX BASIC if the removed expression causes an exception. In the following example, the program generates a divide-by-zero error in VAX BASIC. It runs without error in I64 BASIC/Alpha BASIC because I64 BASIC/Alpha BASIC, recognizing that the variable A is never used, does not generate code to evaluate the expression that is assigned to A:
B = 5 A = B / 0 END |
There is a small difference in the way compiler messages are reported. In VAX BASIC, the source information appears before the message text, and includes both source and listing line numbers. In I64 BASIC/Alpha BASIC, the source information appears after the message text and includes only source line numbers.
When the I64 BASIC/Alpha BASIC compiler reports source line information, the message looks like:
%BASIC-E-xxxxxxxxx, xxxxxxxxxxxxx at line number YY in file xxxxxxxxxxx |
In both I64 BASIC/Alpha BASIC and VAX BASIC, the reported
line number is the physical source line in the file. It is not the
BASIC line number that might occur in the source program.
C.2.3.15 Error Status Returned to DCL
When errors occur, the I64 BASIC/Alpha BASIC and VAX BASIC
compilers at times return a different status to DCL. For example, when
the file specified at the DCL command line cannot be found,
I64 BASIC/Alpha BASIC returns BASIC--F--ABORT; VAX BASIC
returns BASIC--F--OPENIN.
C.2.3.16 SYS$INPUT
In I64 BASIC/Alpha BASIC, when you specify SYS$INPUT as the
input file specification at the DCL command line, the object file and
the listing file are named differently from VAX BASIC. In
I64 BASIC/Alpha BASIC, the compiler names the files with the
file types .OBJ and .LIS (with nothing preceding). In VAX BASIC,
the compiler names the files NONAME.OBJ and NONAME.LIS.
C.2.3.17 FSS$ Function
The VAX BASIC compiler compiles a program that uses the FSS$ function, but if the FSS$ function is invoked at run time, the following run-time error is generated:
%BAS-F-NOTIMP, Not implemented |
The I64 BASIC/Alpha BASIC compiler reports all uses of the FSS$ function by generating the following error at compile time:
%BAS-E-BLTFUNNOT, built-in function not supported |
The BAS$K_FAC_NO constant is not defined on OpenVMS I64/Alpha systems.
You should replace all occurrences of the EXTERNAL LONG CONSTANT
BAS$K_FAC_NO with EXTERNAL LONG CONSTANT BAS$_FACILITY. OpenVMS VAX
systems use the constant BAS$K_FAC_NO to communicate the facility
number between SYS$LIBRARY:BASRTL.EXE and SYS$LIBRARY:BASRTL2.EXE; it
is not needed on OpenVMS I64/Alpha systems.
C.2.3.19 Math Functions with Different Results
Some math function results differ between I64 BASIC/Alpha BASIC
and VAX BASIC, because underlying OpenVMS I64/Alpha system
routines use improved algorithms to perform these operations.
C.2.3.20 Floating-Point Errors
Some programs that run successfully on OpenVMS VAX systems may fail on OpenVMS I64/Alpha systems with division by zero or other floating-point errors. Examine your failing program for a dirty floating-point zero. A dirty floating-point zero is a number represented by a zero exponent and a nonzero mantissa. Most OpenVMS VAX system instructions treat the invalid floating-point number as a zero, but it causes an exception to be generated by some OpenVMS I64/Alpha instructions.
You cannot create a dirty zero by using BASIC arithmetic expessions. You can create a dirty zero by reading it from a file. BASIC I/O statements, such as GET and MOVE FROM, move bytes of data to a variable without checking that the data is valid for the variable.
Correct the problem in one of the following ways:
The following is an example of a routine that cleans a single precision floating-point number (you can write similiar routines to clean double or G-floating numbers):
SUB CLEAN_SINGLE( SINGLE A ) MAP (OVER) SINGLE B MAP (OVER) WORD W1,W2 B = A IF (W1 AND 32640%) = 0% THEN A = 0 END IF END SUB |
The routine accepts a floating-point number, checks for a zero exponent, and clears the mantissa. It redefines the floating-point number as an integer so that the proper bits are tested.
For more information on floating-point formats and dirty zeros, see the
Alpha Architecture Reference Manual.
C.2.3.21 Error Detection on Illegal MAT Operations
Following are two differences in error detection on illegal MAT operations:
MAT B = A * B |
There are debugging differences between VAX BASIC and I64 BASIC/Alpha BASIC, especially during use of the debugger STEP command around exception handlers, DEF functions, external subprograms, and GOSUB routines.
These differences are described below and in the HP BASIC for OpenVMS User Manual.
When the debugger STEP command is used in source code containing an error, differences occur in the Debugger behavior between OpenVMS VAX and OpenVMS I64/Alpha. These differences are due to architectural differences in the hardware and software of the two systems.
In I64 BASIC/Alpha BASIC, a STEP at a statement that causes an exception might never return control to the debugger. The debugger cannot determine what statement in the BASIC source code will execute after the exception occurs. Therefore, set explicit breaks if you use STEP on statements that cause exceptions.
The following hints should help when you use the STEP command to debug programs that handle errors:
Following are differences in listing files between I64 BASIC/Alpha BASIC and VAX BASIC:
This section describes differences between
I64 BASIC/Alpha BASIC, VAX BASIC, and other languages
within the common language environment.
C.2.4.1 Creating PSECTs with COMMON and MAP Statements
In I64 BASIC/Alpha BASIC, the PSECT attributes are different from those in VAX BASIC, as follows:
I64 BASIC/Alpha BASIC | VAX BASIC |
---|---|
NOPIC | PIC |
NOSHR | SHR |
Alignment of OCTAWORD | Alignment of LONG |
In I64 BASIC/Alpha BASIC, the lengths of the PSECTs that the COMMON and MAP statements create are rounded up to a multiple of 16. The size of COMMON or MAP does not change; the size of the PSECT does. This change is visible only to applications that use shareable images in a multilanguage environment.
Both I64 BASIC/Alpha BASIC and VAX BASIC create PSECTs
that are compatible with those of other languages on the same platform,
with the exception of MACRO. You can link with modules written in
languages other than MACRO without changing code. If you link against
MACRO modules that reference these PSECTs, you may need to make
corresponding changes in the MACRO code.
C.2.4.2 64-Bit Floating-Point Data
In most other HP languages, the default 64-bit floating-point data type has changed from D_floating on OpenVMS VAX systems to G_floating on OpenVMS Alpha systems to T_floating on OpenVMS IA64 systems. If you communicate BASIC DOUBLE (OpenVMS D_floating) data between BASIC and one of the other languages that have made this change, you need to do one of the following:
Direct use of the following routines by I64 BASIC/Alpha BASIC programs is unsupported. Attempts to execute any of these routines will result in an error.
In LIB$ROUTINES module:
LIB$INSERT_TREE_64
LIB$SHOW_VM_64
LIB$SHOW_VM_ZONE_64
In STARLET module:
SYS$CREATE_BUFOBJ_64
SYS$CREATE_GFILE
SYS$CREATE_GPFILE
SYS$CREATE_REGION_64
SYS$CRETVA_64
SYS$CRMPSC_FILE_64
SYS$CRMPSC_GFILE_64
SYS$CRMPSC_GPFILE_64
SYS$DELTVA_64
EXPREG_64
SYS$IO_CLEANUP
SYS$IO_PERFORM
SYS$IO_PERFORMW
SYS$LCKPAG_64
SYS$LKWSET_64
SYS$MGBLSC_64
SYS$PURGE_WS
SYS$SETPRI_64
SYS$ULKPAG_64
SYS$ULWSET_64
SYS$UPDESC_64
SYS$UPDSEC_64W
Index | Contents |