[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP BASIC for OpenVMS

User Manual

Order Number: AA--HY15F--TK


January 2005

This manual describes how to develop HP BASIC programs and use HP BASIC features on HP OpenVMS Industry Standard 64 and HP OpenVMS Alpha systems.

Revision/Update Information: This revised manual supersedes the Compaq BASIC OpenVMS Alpha and VAX Systems User Manual, Version 1.4.

Software Version: HP BASIC Version 1.6
for OpenVMS Systems

Operating System and Version: OpenVMS I64 Version 8.2 or higher
OpenVMS Alpha Version 7.1 or higher
(with IEEE floating-point support)
OpenVMS Alpha Version 6.1 or higher
(without IEEE floating-point support)




Hewlett-Packard Company Palo Alto, California


© Copyright 2005 Hewlett-Packard Development Company, L.P.

Confidential computer software. Valid license from HP 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.

The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.

Intel and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

Printed in the US

ZK5424

Contents Index


Preface

This manual describes how to develop and use HP BASIC programs on OpenVMS systems and describes BASIC language features.

Note

In this manual, the term OpenVMS refers to both OpenVMS I64 and OpenVMS Alpha systems. If there are differences in the behavior of the HP BASIC compiler on the two operating systems, those differences are noted.

The term I64 BASIC refers to HP BASIC on OpenVMS I64 systems.

Alpha BASIC refers to HP BASIC on OpenVMS Alpha systems.

VAX BASIC refers to VAX BASIC on OpenVMS VAX systems.

Intended Audience

This manual is intended for programmers who compile, link, and execute HP BASIC programs on OpenVMS systems. Users should have a working knowledge of BASIC or another high-level programming language, the Digital Command Language (DCL), and DCL command procedures.

Document Structure

This manual contains the following chapters and appendixes:

Part 1 Developing HP BASIC Programs on OpenVMS Systems

  • Chapter 1 provides a brief overview of HP BASIC.
  • Chapter 2 describes how to develop programs at DCL command level and how to generate a compiler listing.
  • Chapter 3 describes how to use the OpenVMS Debugger to debug HP BASIC programs.

Part 2 HP BASIC Programming Concepts

  • Chapter 4 explains how to get started with HP BASIC.
  • Chapter 5 explains simple input and output procedures.
  • Chapter 6 shows how to use arrays.
  • Chapter 7 explains data definitions.
  • Chapter 8 explains how to create user-defined data structures with the RECORD statement.
  • Chapter 9 shows how to control the flow of program execution.
  • Chapter 10 explains how to use functions.
  • Chapter 11 explains how to handle strings.
  • Chapter 12 describes structured programming techniques.
  • Chapter 13 explains how to manage files.
  • Chapter 14 describes how to format output with the PRINT USING statement.
  • Chapter 15 explains error-handling techniques.
  • Chapter 16 shows how to use compiler directives.
  • Chapter 17 describes how BASIC represents data.

Part 3 Using HP BASIC Features on OpenVMS Systems

  • Chapter 18 describes additional I/O considerations on OpenVMS systems.
  • Chapter 19 describes OpenVMS System Services and Run-Time Library routines.
  • Chapter 20 describes the use of user-supplied libraries and shareable images.
  • Chapter 21 describes how to use CDD/Repository capabilities.
  • Chapter 22 describes using standard Motif Bindings with BASIC.

Appendixes

  • Appendix A lists compile-time error messages.
  • Appendix B lists run-time error messages.
  • Appendix C provides an overview of the optional productivity tools.

Related Documents

For more information about language elements, syntax, and reference information, see the HP BASIC for OpenVMS Reference Manual.

Reader's Comments

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

Internet openvmsdoc@hp.com
Postal Mail Hewlett-Packard Company
OSSG Documentation Group, ZKO3-4/U08
110 Spit Brook Rd.
Nashua, NH 03062-2698

Conventions

The following product names may appear in this manual:

  • HP OpenVMS Industry Standard 64 for Integrity Servers
  • OpenVMS I64
  • I64

All three names---the longer form and the two abbreviated forms---refer to the version of the OpenVMS operating system that runs on the Intel® Itanium® architecture.

The following typographic conventions might be used in this manual:

Ctrl/ x A sequence such as Ctrl/ x indicates that you must hold down the key labeled Ctrl while you press another key or a pointing device button.
PF1 x A sequence such as PF1 x indicates that you must first press and release the key labeled PF1 and then press and release another key or a pointing device button.
[Return] In examples, a key name enclosed in a box indicates that you press a 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.

... 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 command format descriptions, parentheses indicate that you must enclose choices in parentheses if you specify more than one.
[ ] In command format descriptions, brackets indicate optional choices. You can choose one or more items or no items. Do not type the brackets on the command line. However, you must include the brackets in the syntax for OpenVMS directory specifications and for a substring specification in an assignment statement.
| In command format descriptions, vertical bars separate choices within brackets or braces. Within brackets, the choices are optional; within braces, at least one choice is required. Do not type the vertical bars on the command line.
{ } In command format descriptions, braces indicate required choices; you must choose at least one of the items listed. Do not type the braces on the command line.
bold type Bold type represents the introduction of a new term. It also represents the name of an argument, an attribute, or a reason.
italic type Italic type indicates important information, complete titles of manuals, or variables. Variables include information that varies in system output (Internal error number), in command lines (/PRODUCER= name), and in command parameters in text (where dd represents the predefined code for the device type).
UPPERCASE TYPE Uppercase type indicates a command, the name of a routine, the name of a file, or the abbreviation for a system privilege.
- A hyphen at the end of a command format description, command line, or code line indicates that the command or statement continues on the following line.
numbers All numbers in text are assumed to be decimal unless otherwise noted. Nondecimal radixes---binary, octal, or hexadecimal---are explicitly indicated.

Mnemonics and Other Terms Used in Syntax Diagrams

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
rec-exp Record expression; record number within a file
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


Part 1
Developing BASIC Programs on OpenVMS Systems

Part 1 provides an overview of BASIC and describes how to develop and debug BASIC programs. It shows you how to get started on the OpenVMS system and how to develop programs.


Chapter 1
Overview of HP BASIC

BASIC is a powerful structured programming language designed for novice and application programmers alike.

BASIC was originally developed for students with little or no programming experience. Since then, BASIC has become one of the most widely used programming languages and is available on almost every computer system.

The OpenVMS implementations of BASIC have evolved beyond the original design but still support all of the traditional features of the original language in addition to more recent programming techniques. HP BASIC has become much more than a teaching tool and is used in a wide variety of sophisticated applications.

1.1 Language Constructs Supported

HP BASIC supports the following language constructs:

  • Code without line numbers (traditional line numbers are optional)
  • Control structures, such as SELECT CASE
  • Explicit variable declarations
  • Capabilities for handling dynamic strings
  • Adaptable file-handling capabilities for terminal-format files, and the full range of RMS facilities
  • Global and local run-time error handling with WHEN ERROR blocks
  • Compile-time directives
  • A variety of data types, including packed-decimal, user-defined records, and VAX and IEEE floating-point data types.
  • Extensive error checking with meaningful error messages
  • Thirty-one character names for variables, labels, functions, and subprograms

1.2 Advantages on OpenVMS

HP BASIC uses the OpenVMS operating system to its full advantage and is integrated with many other HP products. In particular, HP BASIC supports:

  • The OpenVMS systems standard calling procedures
  • Record definitions included from the OpenVMS Common Data Dictionary
  • Code analysis with the Performance and Coverage Analyzer (PCA)
  • Creation of code with the Language-Sensitive Editor (LSE)
  • Extensive online language help
  • Exchange of data with other systems using DECnet

HP BASIC supports features of other versions of BASIC, including PDP-11 BASIC-PLUS-2. The /FLAG qualifier allows you to check whether programs contain declining features that should be replaced with newer ones.

When you write programs in HP BASIC, you develop programs at the DCL command level. You write your source program with a text editor, then compile, link, and run the program with commands to the OpenVMS operating system.


Next Contents Index