# Compaq BASIC for OpenVMS
Alpha and VAX Systems

# Reference Manual

Order Number: AA--HY16E-TK

# April 2000

This manual provides reference, syntax, and language element information for Compaq BASIC.

Revision/Update Information: This revised manual supersedes the DEC BASIC and VAX BASIC for OpenVMS Systems Reference Manual.

Software Version: Compaq BASIC Version 1.4
for OpenVMS Alpha Systems
Compaq BASIC Version 3.8
for OpenVMS VAX Systems

Operating System and Version: OpenVMS Alpha Version 7.1 or higher
(with IEEE floating-point support);
OpenVMS Alpha Version 6.1 or higher
(without IEEE floating-point support); or
OpenVMS VAX Version 5.5-2 or higher

Compaq Computer Corporation
Houston, Texas

© 2000 Compaq Computer Corporation

COMPAQ, VAX, VMS, the Compaq logo, and the DIGITAL logo Registered in U.S. Patent and Trademark Office.

Alpha, DEC BASIC, OpenVMS, and VAX BASIC are trademarks of Compaq Information Technologies Group, L.P.

All other product names mentioned herein may be the trademarks or registered trademarks of their respective companies.

Confidential computer software. Valid license from Compaq or authorized sublicensor required for possession, use, or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license.

Compaq shall not be liable for technical or editorial errors or omissions contained herein.

The information in this publication is subject to change without notice and is provided "AS IS" WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK ARISING OUT OF THE USE OF THIS INFORMATION REMAINS WITH RECIPIENT. IN NO EVENT SHALL COMPAQ BE LIABLE FOR ANY DIRECT, CONSEQUENTIAL, INCIDENTAL, SPECIAL, PUNITIVE, OR OTHER DAMAGES WHATSOEVER (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, OR LOSS OF BUSINESS INFORMATION), EVEN IF COMPAQ HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THE FOREGOING SHALL APPLY REGARDLESS OF THE NEGLIGENCE OR OTHER FAULT OF EITHER PARTY AND REGARDLESS OF WHETHER SUCH LIABILITY SOUNDS IN CONTRACT, NEGLIGENCE, TORT, OR ANY OTHER THEORY OF LEGAL LIABILITY, AND NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.

The limited warranties for Compaq products are exclusively set forth in the documentation accompanying such products. Nothing herein should be construed as constituting a further or additional warranty.

ZK5433

The Compaq OpenVMS documentation set is available on CD-ROM.

Contents | Index

# Preface

Compaq BASIC for OpenVMS Alpha is the new name for DEC BASIC. Compaq BASIC for OpenVMS VAX is the new name for VAX BASIC. Any references to the former names in product documentation or other components should be construed as references to the Compaq BASIC names. Any references to BASIC or to Compaq BASIC apply to both products unless otherwise specified. References to the shortened names Alpha BASIC and VAX BASIC mean Compaq BASIC for OpenVMS Alpha and Compaq BASIC for OpenVMS VAX, respectively.

This manual describes BASIC language elements and syntax.

# Intended Audience

This manual is intended for experienced applications programmers who have a fundamental understanding of the BASIC language. Some familiarity with your operating system is also recommended. This is not a tutorial manual.

# Document Structure

This manual contains the following chapters and appendixes:

- Chapter 1 summarizes BASIC program elements and structure.
- Chapter 2 describes the environment commands (VAX BASIC only).
- Chapter 3 describes the compiler directives.
- Chapter 4 describes the statements and functions.
- Appendix A lists the ASCII codes.
- Appendix B lists the BASIC keywords.
- Appendix C discusses differences between Alpha BASIC and VAX BASIC.

Chapters 2, 3, and 4 provide reference material on each BASIC language element. The language elements are arranged in alphabetical order within these chapters; each language element begins on a separate page. The descriptions include the following sections:

Definition | A description of what the statement or command does.
Format | The required syntax for the language element.
Syntax Rules | Any rules governing the use of parameters, separators, or other syntax items, effect of the statement or command on program execution, and any restrictions governing its use.
Remarks | Further explanations or restrictions about the statement or command.
Example | One or more examples of the statement in a partial program. Where appropriate, explanatory text and program output are included.

# Platform Labels

A platform is a combination of operating system and central processing unit (CPU) that provides a distinct environment in which to use a product (in this case, a language). This manual contains information for the following language platforms:

- OpenVMS Alpha
- OpenVMS VAX

Information in this manual applies to both supported platforms, unless it is otherwise noted. Platform-specific information is noted in the manual as follows:

- Alpha BASIC refers to information that is correct for Compaq BASIC for OpenVMS Alpha systems.
- VAX BASIC refers to information that is correct for Compaq BASIC for OpenVMS VAX systems.

# Related Documents

For detailed information about developing, compiling, linking, and running BASIC programs, see the Compaq BASIC for OpenVMS Alpha and VAX Systems User Manual.

For additional information about OpenVMS products and services, access the following World Wide Web address:

    http://www.compaq.com/

# Reader's Comments

Compaq welcomes your comments on this manual. Please send comments to either of the following addresses:

Internet | basic_docs@compaq.com
Mail | Compaq Computer Corporation OSSG Documentation Group, ZKO3-4/U08 110 Spit Brook Rd. Nashua, NH 03062-2698

# How to Order Additional Documentation

If you have access to the World Wide Web, please visit our website at

      http://www.openvms.digital.com/commercial/basic/basic_index.html

Click Software Product Description, and read the ordering information. Note the order numbers of the documents you want. For pricing and further information, call 1--800--282-6672.

Use the following World Wide Web address for information about how to order OpenVMS operating system documentation:

    http://www.compaq.com/

If you need help deciding which documentation best meets your needs, call 1--800--282--6672.

# Conventions

In this manual, every use of the name Compaq BASIC or the name BASIC applies to both Compaq BASIC for OpenVMS Alpha and Compaq BASIC for OpenVMS VAX software.

Table 1 shows the conventions used in this manual.

Table 1 Conventions Used in This Manual
Convention | Description
--- | ---
$ | A dollar sign ($) represents the OpenVMS DCL system prompt.
`[Return]` | In examples, a key name enclosed in a box indicates that you press that key on the keyboard. (In text, a key name is not enclosed in a box.) In the HTML version of this document, this convention appears as brackets, rather than a box.
Ctrl/ x | The key combination Ctrl/ x indicates that you must hold down the key labeled Ctrl while you press another key, for example Ctrl/Y or Ctrl/Z.
KP n | The phrase KP n indicates that you must press the key labeled with the number or character n on the numeric keypad, for example, KP3 or KP-.
PF1 x | A sequence such as PF1 x indicates that you must first press and release the key labeled PF1, then press and release another key.
n | A lowercase italic n indicates the generic use of a number.
... | A horizontal ellipsis in examples indicates one of the following possibilities: Additional optional arguments in a statement have been omitted. The preceding item or items can be repeated one or more times. Additional parameters, values, or other information can be entered.
. . . | A vertical ellipsis indicates the omission of items from a code example or command format; the items are omitted because they are not important to the topic being discussed.
() | In format descriptions, parentheses indicate that you must enclose the options in parentheses if you choose more than one.
[] | In format descriptions, brackets indicate optional elements; you can select none, one, or all of the elements.
{ } | In format descriptions, braces indicate that one element in a list is required. You must choose one and only one from the list.
boldface text | Boldface text is used for the introduction of a new term.
italic text | Italic text represents parameters, arguments, and information that can vary in system messages (for example, Internal error number), as well as book titles and emphasized information.
UPPERCASE | Uppercase indicates the name of a command, routine, file, or file protection code, or the abbreviation for a system privilege.

Table 2 defines mnemonics and other terms used in the syntax diagrams.

Table 2 Mnemonics and Other Terms Used in Syntax
Term | Meaning
--- | ---
angle | Angle in radians or degrees
array | Array; syntax rules specify whether the bounds or dimensions can be specified
chnl | I/O channel associated with a file
chnl-exp | Numeric expression that specifies a channel number
com | Specific to a COMMON block
cond | Conditional expression; indicates that an expression can be either logical or relational
cond-exp | Conditional expression
const | Constant value
data-type | Data type keyword
decimal-var | Decimal variable
decl-item | Array, record, or variable
def | Specific to a DEF function
delim | Delimiter
equiv-name | File specification, device, or logical name to be assigned a logical name
err-num | Run-time error number
exp | Expression
ext-routine | External function
external-param | External parameter
file-spec | File specification
func | Specific to a FUNCTION subprogram
int | Integer value
int-const | Integer constant
int-exp | Expression that represents an integer value
int-var | Variable that contains an integer value
label | Alphanumeric statement label
lex | Lexical; used to indicate a component of a compiler directive
lex-exp | Lexical expression
lex-var | Lexical variable
line | Statement line; may or may not be numbered
line-num | Statement line number
lit | Literal value, in quotation marks
log-exp | Logical expression
log-name | 1- to 63-character logical name to be associated with equiv-name
macro-id | User identifier following the rules for BASIC identifiers
map | Specific to a MAP statement
matrix | Two-dimensional array
name | Name or identifier; indicates the declaration of a name or the name of a BASIC structure, such as a SUB subprogram
num | Numeric value
num-lit | Numeric literal
param-list | Parameter list, such as for a SUB subprogram
pass-mech | Valid BASIC passing mechanism
prog-name | Program name
real | Floating-point value
real-exp | Real expression
real-var | Real variable
rel-exp | Relational expression
relationship-type | Oracle CDD/Repository protocol
replacement-token | Identifier, keyword, compiler directive, literal constant, or operator
routine | SUB subprogram or other callable procedure
str | Character string
str-exp | Expression that represents a character string
str-lit | String literal
str-var | Variable that contains a character string
sub | Specific to a SUB subprogram
target | Target point of a branch statement; either a line number or a label
unq-str | Unique string
unsubs-var | Unsubscripted variable, as opposed to an array element
var | Variable

Next | Contents | Index