Compaq BASIC for OpenVMS
Alpha and VAX Systems
Reference Manual


Previous Contents Index


Appendix B
BASIC Keywords

The following is a list of the BASIC keywords. Most of the keywords are reserved; unreserved keywords are marked with a dagger (+).

%ABORT
%CDD+
%CROSS
%DEFINE
%ELSE
%END
%FROM
%IDENT
%IF
%INCLUDE
%LET
%LIBRARY
%LIST
%NOCROSS
%NOLIST
%PAGE
%PRINT
%SBTTL
%THEN
%TITLE
%UNDEFINE
%VARIANT
ABORT
ABS
ABS%
ACCESS
ACCESS%
ACTIVATE
ACTIVE
ALIGNED
ALLOW
ALTERNATE
AND
ANGLE+
ANY
APPEND
AREA+
AS
ASC
ASCENDING
ASCII
ASK
AT+
ATN
ATN2
BACK
BASE
BASIC
BEL
BINARY
BIT
BLOCK
BLOCKSIZE
BS
BUCKETSIZE
BUFFER
BUFSIZ
BY
BYTE
CALL
CASE
CAUSE
CCPOS
CHAIN
CHANGE
CHANGES
CHECKING
CHOICE+
CHR$
CLEAR
CLIP+
CLK$
CLOSE
CLUSTERSIZE
COLOR+
COM
COMMON
COMP%
CON
CONNECT
CONSTANT
CONTIGUOUS
CONTINUE
COS
COT
COUNT
CR
CTRLC
CVTF$
CVT$F
CVT$$
CVT$%
CVT%$
DAT
DAT$
DATA
DATE$
DEACTIVATE
DECIMAL
DECLARE
DEF
DEF*
DEFAULTNAME
DEL
DELETE
DESC
DESCENDING
DET
DEVICE
DIF$
DIM
DIMENSION
DOUBLE
DOUBLEBUF
DRAW
DUPLICATES
DYNAMIC
ECHO
EDIT$
ELSE
END
EQ
EQV
ERL
ERN$
ERR
ERROR
ERT$
ESC
EXIT
EXP
EXPAND+
EXPLICIT
EXTEND
EXTENDSIZE
EXTERNAL
FF
FIELD
FILE
FILESIZE
FILL
FILL$
FILL%
FIND
FIX
FIXED
FLUSH
FNAME$
FNEND
FNEXIT
FONT+
FOR
FORMAT$
FORTRAN
FREE
FROM
FSP$
FSS$
FUNCTION
FUNCTIONEND
FUNCTIONEXIT
GE
GET
GETRFA
GFLOAT
GO
GOBACK
GOSUB
GOTO
GRAPH
GRAPHICS+
GROUP
GT
HANDLE
HANDLER
HEIGHT+
HFLOAT
HT
IDN
IF
IFEND
IFMORE
IMAGE
IMP
IN+
INACTIVE
INDEX+
INDEXED
INFORMATIONAL
INITIAL
INKEY$
INPUT
INSTR
INT
INTEGER
INV
INVALID
ITERATE
JSB
JUSTIFY+
KEY
KILL
LBOUND
LEFT
LEFT$
LEN
LET
LF
LINE
LINES+
LINO
LINPUT
LIST
LOC
LOCKED
LOG
LOG10
LONG
LSET
MAG
MAGTAPE
MAP
MAR
MAR%
MARGIN
MAT
MAX
METAFILE+
MID
MID$
MIN
MIX+
MOD
MOD%
MODE
MODIFY
MOVE
MULTIPOINT+
NAME
NEXT
NO+
NOCHANGES
NODATA
NODUPLICATES
NOECHO
NOEXTEND
NOMARGIN
NONE
NOPAGE
NOREWIND
NOSPAN
NOT
NUL$
NUM
NUM$
NUM1$
NUM2
NX
NXEQ
OF
ON
ONECHR
ONERROR
OPEN
OPTION
OPTIONAL
OR
ORGANIZATION
OTHERWISE
OUTPUT
OVERFLOW
PAGE
PATH+
PEEK
PI
PICTURE
PLACE$
PLOT
POINT+
POINTS+
POS
POS%
PPS%
PRIMARY
PRINT
PRIORITY+
PROD$
PROGRAM
PROMPT+
PUT
QUAD
QUO$
RAD$
RANDOM
RANDOMIZE
RANGE+
RCTRLC
RCTRLO
READ
REAL
RECORD
RECORDSIZE
RECORDTYPE
RECOUNT
REF
REGARDLESS
RELATIVE
REM
REMAP
RESET
RESTORE
RESUME
RETRY
RETURN
RFA
RIGHT
RIGHT$
RMSSTATUS
RND
ROTATE
ROUNDING
RSET
SCALE
SCRATCH
SEG$
SELECT
SEQUENTIAL
SET
SETUP
SEVERE
SFLOAT
SGN
SHEAR
SHIFT
SI
SIN
SINGLE
SIZE
SLEEP
SO
SP
SPACE+
SPACE$
SPAN
SPEC%
SQR
SQRT
STATUS
STEP
STOP
STR$
STREAM
STRING
STRING$
STYLE+
SUB
SUBEND
SUBEXIT
SUBSCRIPT
SUM$
SWAP%
SYS
TAB
TAN
TEMPORARY
TERMINAL
TEXT+
TFLOAT
THEN
TIM
TIME
TIME$
TO
TRAN+
TRANSFORM
TRANSFORMATION+
TRM$
TRN
TYP
TYPE
TYPE$
UBOUND
UNALIGNED
UNDEFINED
UNIT+
UNLESS
UNLOCK
UNTIL
UPDATE
USAGE$
USEROPEN
USING
USR$
VAL
VAL%
VALUE
VARIABLE
VARIANT
VFC
VIEWPORT+
VIRTUAL
VPS%
VT
WAIT
WARNING
WHEN
WHILE
WINDOW+)
WINDOWSIZE
WITH+
WORD
WRITE
XFLOAT
XLATE
XLATE$
XOR
ZER

Note

+ Unreserved keyword

+ Unreserved keyword


Appendix C
Differences Between Alpha BASIC and VAX BASIC

Compaq BASIC for OpenVMS Alpha systems (hereafter referred to as Alpha BASIC) is based on and compatible with Compaq BASIC for OpenVMS VAX systems (hereafter referred to as (VAX BASIC).

Alpha BASIC supports most of the VAX BASIC features. This appendix describes the differences between Alpha BASIC and VAX BASIC.

C.1 Feature Differences

This section describes the following:

C.1.1 VAX BASIC Features Not Available in Alpha BASIC

Table C-1 describes the VAX BASIC features not available in Alpha BASIC. There are no plans for Alpha BASIC to support these features.

Table C-1 VAX BASIC Features Not Available in Alpha BASIC
Features Comments
/[NO]ANSI_STANDARD Enforces the ANSI Minimal BASIC standard.
VAX BASIC Environment The VAX BASIC Environment provides features specific to BASIC for program development. The RUN command and immediate mode are not supported.
/[NO]SYNTAX_CHECK Specifies syntax checking after every entered line.
/[NO]FLAG=[BP2COMPATIBILITY] Notifies VAX BASIC users of VAX BASIC features that are not compatible with PDP--11 BASIC/PLUS2.
/[NO]FLAG=[AXPCOMPATIBILITY] Notifies VAX BASIC users of VAX BASIC features that are not supported by Alpha BASIC.
Graphics statements Graphics statements are not supported.
HFLOAT data type Specifies floating-point format for floating-point data. Additionally, the HFLOAT argument to the REAL built-in function is not supported.
/[NO]DESIGN There is no support for the Program Design Facility (PDF). The compiler does not attempt to compile a program when /DESIGN is specified.

C.1.2 Alpha BASIC Features Not Available in VAX BASIC

Table C-2 describes Alpha BASIC command line qualifiers not available in VAX BASIC. For detailed information about all the BASIC qualifiers, see the Compaq BASIC for OpenVMS Alpha and VAX Systems User Manual.

Table C-2 Alpha BASIC Qualifiers Not Available in VAX BASIC
Qualifier Comments
/INTEGER_SIZE=QUAD Allows you to specify that integers should be quadwords (that is, 64 bits in size).
/OPTIMIZE=LEVEL= n Controls the level of optimization done by the compiler. (/OPTIMIZE without the LEVEL is available in VAX BASIC; see Section C.2.1.)
/REAL_SIZE={SFLOAT | TFLOAT | XFLOAT} Allows you to specify one of the IEEE floating-point data types, SFLOAT, TFLOAT, or XFLOAT.
/SEPARATE_COMPILATION Controls whether an individual compilation unit becomes a separate module in an object file.
/SYNCHRONOUS_EXCEPTIONS Controls whether or not the compiler emits additional code to emulate VAX BASIC exception behavior.
/WARNINGS=ALIGNMENT Instructs the compiler to flag all occurrences of non-naturally aligned RECORD fields, variables within COMMONs and MAPs, and RECORD arrays.

C.2 Behavior Differences

This section describes the behavior differences between Alpha BASIC and VAX BASIC.

C.2.1 Optimization

In both Alpha BASIC and VAX BASIC, the /[NO]OPTIMIZE qualifier controls whether optimization is turned on or off, and for both the default is /OPTIMIZE (unless /DEBUG is specified).

The difference is that Alpha BASIC allows you to specify which of four levels of optimization the compiler should perform. The default is /OPTIMIZE=LEVEL=4 (full optimization). In VAX BASIC, you cannot specify a level of optimization. For more information, see the section on BASIC command qualifiers in the Compaq BASIC for OpenVMS Alpha and VAX Systems User Manual.

C.2.2 Data Types

The following data types are discussed in this section:

C.2.2.1 QUAD, SFLOAT, TFLOAT, and XFLOAT

Alpha BASIC has four data types not available in VAX BASIC:

These four data types allow the Alpha BASIC user to take advantage of the 64-bit Alpha architecture.

C.2.2.2 Implicit Use of the HFLOAT Data Type

VAX BASIC performs some intermediate calculations in the HFLOAT data type, even if the source code does not explicitly specify its use. This generally occurs when mixed data type operations are performed between large DECIMAL items and floating-point items. For more information about VAX BASIC behavior, see Section 1.6.1.1.

Alpha BASIC performs these operations in GFLOAT. As a result, some loss of precision is possible. Alpha BASIC issues the following compile-time warning message if source code is encountered that results in this difference:


OPEPERGFL, operation performed in GFLOAT, loss of precision possible 

C.2.2.3 Double Data Type

The Alpha hardware does not completely support the D-floating data type. Alpha BASIC performs BASIC DOUBLE operations (+, -, and so on) in G-floating (consistent with other languages on OpenVMS Alpha systems). As a result, the operations lose three bits of precision.

Alpha BASIC performs mixed operations between GFLOAT and DOUBLE in GFLOAT, not HFLOAT. VAX BASIC performs mixed operations between GFLOAT and DOUBLE in HFLOAT.

Conversions between the human world of decimal numbers and the binary world of computers cause rounding errors. For example, .1 (1/10) cannot be represented exactly in either D_floating or G_floating data type. It must be rounded. Because the D_floating and G_floating representations provide differing amounts of precision, the rounding error may be slightly different. As a result, the D_floating and G_floating representations of the same decimal number are not always the same when converted back to decimal.

C.2.2.4 HFLOAT Data Type and HFLOAT COMPLEX Data Type in Oracle CDD/Repository

Alpha BASIC does not support HFLOAT. Neither Alpha BASIC nor VAX BASIC support the HFLOAT COMPLEX data type. The following sections discuss the translations that occur when reading records from Oracle CDD/Repository.

HFLOAT Data Type

In Alpha BASIC, HFLOAT data types generate a GROUP using the name of the HFLOAT item specified in Oracle CDD/Repository. The GROUP contains a single 16 byte string item. Because HFLOAT is not supported, the compiler generates an informational message similiar to those caused by other unsupported data types.

Example C-1 is an Alpha BASIC example. Example C-2 is a VAX BASIC example.

Example C-1 Alpha BASIC HFLOAT Translation

 
GROUP MY_H_REAL 
    STRING STRING_VALUE = 16 
END GROUP 
 

Example C-2 VAX BASIC HFLOAT Translation

 
HFLOAT MY_H_REAL 
 

HFLOAT COMPLEX Data Type

In Alpha BASIC, the Oracle CDD/Repository data type HFLOAT COMPLEX maps to a GROUP of two 16-byte static strings. Example C-3 shows Oracle CDD/Repository output on Alpha BASIC.

Example C-3 Oracle CDD/Repository HFLOAT COMPLEX Data Type with Alpha BASIC

GROUP MY_H_COMPLEX 
    STRING HFLOAT_R_VALUE = 16 
    STRING HFLOAT_I_VALUE = 16 
END GROUP 
 

Example C-4 shows Oracle CDD/Repository output on VAX BASIC.

Example C-4 Oracle CDD/Repository HFLOAT COMPLEX Data Type with VAX BASIC

 
GROUP MY_H_COMPLEX 
    HFLOAT HFLOAT_R_VALUE 
    HFLOAT HFLOAT_I_VALUE 
END GROUP 
 

C.2.3 Array Parameters

The following are differences in the way Alpha BASIC and VAX BASIC handle array parameters:

C.2.4 DEF* Routines

In Alpha BASIC, DEF* routines cannot be called from within DEF routines or WHEN handlers. If such calls are attempted, the following error message is issued:


%BASIC-E-DEFSNOTALL, DEF* reference not allowed in DEF or handler 

Alpha BASIC gives highest precedence to DEF* routines that are called from within an expression. Thus, a DEF* routine call is evaluated first. When the DEF* routine directly modifies the values of variables used within the same expression, this can affect the result of the expression. If the compiler changes the order of a DEF* call in an expression, it issues the following warning message:


%BASIC-W-DEFEXPCOM, expression with DEF* too complex, moving <name> invocation 

You can avoid this by simplifying the expression.

C.2.5 /LINES Qualifier

In Alpha BASIC, the /LINES qualifier affects only the ERL function and determines whether BASIC line numbers are reported in run-time error messages. The following differences exist in Alpha BASIC:

C.2.6 Appending Files at the DCL Command Line

VAX BASIC requires that source files using the plus sign (+) to append source files use line numbers within the files; otherwise, an error message is issued.

Alpha BASIC does not require line numbers in either of the source files. The plus sign is treated as an OpenVMS append operator. Alpha BASIC appends and compiles the separate files as if they were a single source file.

C.2.7 Unreachable Code Error

Alpha BASIC performs extensive analysis when searching for unreachable code and may report more occurrences than VAX BASIC.

In Alpha BASIC, the compile-time error message for unreachable code, UNREACH, is an informational message. In VAX BASIC, the compile-time error message for unreachable code, INACOFOL, is a warning.

Alpha BASIC checks for DEF functions that are never referenced and issues the informational message "UNCALLED, routine xxxx can never be called."

C.2.8 Line Numbers

In 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. 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 location of the TPU command procedure is:

SYS$COMMON:[SYSHLP.EXAMPLES.BASIC]BASIC$ENV.TPU.

Instructions for its use are in the file.

Note

Although there are no known problems, the TPU command procedure has not been thoroughly tested. As a result, it is not supported by Compaq.


Previous Next Contents Index