VAX BASIC Reference Manual

*HyperReader

  CONTENTS

  Title Page

  Copyright Page

  Preface

  Summary of Technical Changes

  1      Program Elements and Structure

  1.1     Components of Program Lines
    1.1.1      Line Numbers
      1.1.1.1      Programs With Line Numbers
      1.1.1.2      Programs Without Line Numbers
    1.1.2      Labels
    1.1.3      Statements
      1.1.3.1      Keywords
      1.1.3.2      Identifying Program Units
      1.1.3.3      Single-Statement Lines and Continued Statements
      1.1.3.4      Multi-Statement Lines
    1.1.4      Compiler Directives
    1.1.5      Line Terminators
    1.1.6      Lexical Order

  1.2     VAX BASIC Character Set

  1.3     VAX BASIC Data Types
    1.3.1      Implicit Data Typing
    1.3.2      Explicit Data Typing

  1.4     Variables
    1.4.1      Variable Names
    1.4.2      Implicitly Declared Variables
    1.4.3      Explicitly Declared Variables
    1.4.4      Subscripted Variables and Arrays
    1.4.5      Initialization of Variables

  1.5     Constants
    1.5.1      Numeric Constants
      1.5.1.1      Floating-Point Constants
      1.5.1.2      Integer Constants
      1.5.1.3      Packed Decimal Constants
    1.5.2      String Constants
    1.5.3      Named Constants
      1.5.3.1      Naming Constants Within a Program Unit
      1.5.3.2      Naming Constants External to a Program Unit
    1.5.4      Explicit Literal Notation
    1.5.5      Predefined Constants

  1.6     Expressions
    1.6.1      Numeric Expressions
      1.6.1.1      Floating-Point and Integer Promotion Rules
      1.6.1.2      DECIMAL Promotion Rules
    1.6.2      String Expressions
    1.6.3      Conditional Expressions
      1.6.3.1      Numeric Relational Expressions
      1.6.3.2      String Relational Expressions
      1.6.3.3      Logical Expressions
    1.6.4      Evaluating Expressions

  1.7     Program Documentation
    1.7.1      Comment Fields
    1.7.2      REM Statements

  2      Environment Commands

  !  your-comment

  $ system-command

  APPEND

  ASSIGN

  COMPILE

  CONTINUE

  DELETE

  EDIT

  EXIT

  HELP

  IDENTIFY

  INQUIRE

  LIST and LISTNH

  LOAD

  LOCK

  NEW

  OLD

  RENAME

  REPLACE

  RESEQUENCE

  RUN

  SAVE

  SCALE

  SCRATCH

  SEQUENCE

  SET

  SHOW

  UNSAVE

  3      Compiler Directives

  %ABORT

  %CROSS

  %DECLARED

  %IDENT

  %IF-%THEN-%ELSE-%END %IF

  %INCLUDE

  %LET

  %LIST

  %NOCROSS

  %NOLIST

  %PAGE

  %PRINT

  %REPORT

  %SBTTL

  %TITLE

  %VARIANT

  4      Statements and Functions

  ABS

  ABS%

  ASCII

  ATN

  BUFSIZ

  CALL

  CAUSE ERROR

  CCPOS

  CHAIN

  CHANGE

  CHR$

  CLOSE

  COMMON

  COMP%

  CONTINUE

  COS

  CTRLC

  CVT$$

  CVTxx

  DATA

  DATE$

  DECIMAL

  DECLARE

  DEF

  DEF *

  DELETE

  DET

  DIF$

  DIMENSION

  ECHO

  EDIT$

  END

  ERL

  ERN$

  ERR

  ERT$

  EXIT

  EXP

  EXTERNAL

  FIELD

  FIND

  FIX

  FNEND

  FNEXIT

  FOR

  FORMAT$

  FREE

  FSP$

  FUNCTION

  FUNCTIONEND

  FUNCTIONEXIT

  GET

  GETRFA

  GOSUB

  GOTO

  HANDLER

  IF

  INKEY$

  INPUT

  INPUT LINE

  INSTR

  INT

  INTEGER

  ITERATE

  KILL

  LBOUND

  LEFT$

  LEN

  LET

  LINPUT

  LOC

  LOG

  LOG10

  LSET

  MAG

  MAGTAPE

  MAP

  MAP DYNAMIC

  MAR

  MARGIN

  MAT

  MAT INPUT

  MAT LINPUT

  MAT PRINT

  MAT READ

  MAX

  MID$

  MIN

  MOD

  MOVE

  NAME...AS

  NEXT

  NOECHO

  NOMARGIN

  NUM

  NUM2

  NUM$

  NUM1$

  ON ERROR GO BACK

  ON ERROR GOTO

  ON ERROR GOTO 0

  ON...GOSUB

  ON...GOTO

  OPEN

  OPTION

  PLACE$

  POS

  PRINT

  PRINT USING

  PROD$

  PROGRAM

  PUT

  QUO$

  RAD$

  RANDOMIZE

  RCTRLC

  RCTRLO

  READ

  REAL

  RECORD

  RECOUNT

  REM

  REMAP

  RESET

  RESTORE

  RESUME

  RETRY

  RETURN

  RIGHT$

  RMSSTATUS

  RND

  RSET

  SCRATCH

  SEG$

  SELECT

  SET PROMPT

  SGN

  SIN

  SLEEP

  SPACE$

  SQR

  STATUS

  STOP

  STR$

  STRING$

  SUB

  SUBEND

  SUBEXIT

  SUM$

  SWAP%

  TAB

  TAN

  TIME

  TIME$

  TRM$

  UBOUND

  UNLESS

  UNLOCK

  UNTIL

  UPDATE

  VAL

  VAL%

  VMSSTATUS

  WAIT

  WHEN ERROR

  WHILE

  XLATE$

  A   Transporting Programs Between VAX BASIC and BASIC-PLUS-2

  A.1     Overview

  A.2     Language-Specific Functionality

  A.3     I/O Differences
    A.3.1      The MAGTAPE Function
    A.3.2      The OPEN Statement
    A.3.3      The PUT Statement

  A.4     Procedure Calling
    A.4.1      The CALL Statement
    A.4.2      The CHAIN Statement
    A.4.3      SYS and FIP SYS Calls

  A.5     Generated Errors

  A.6     Miscellaneous Differences
    A.6.1      Data Types
    A.6.2      The DEF and DEF * Statements
    A.6.3      Default Integer Size
    A.6.4      Integer Overflow
    A.6.5      Line Numbers and Labels
    A.6.6      The MAP and COMMON Statements
    A.6.7      The MAP DYNAMIC Statement
    A.6.8      The PRINT Statement
    A.6.9      The PRINT USING Statement
    A.6.10    The REPLACE Command
    A.6.11    The SPEC% and PEEK Functions
    A.6.12    String Comparisons
    A.6.13    Assigning Symbols
    A.6.14    The TIME Function
    A.6.15    The TIME$ Function

  B   ANSI Minimal BASIC

  B.1     Introduction

  B.2     The /ANSI_STANDARD Qualifier

  B.3     Extensions To ANSI Minimal BASIC Standard X3.60-1978
    B.3.1     Program Format
    B.3.2     Statements
    B.3.3     Delimiters
    B.3.4     Variables
    B.3.5     Numeric Constants
    B.3.6     Data Input
      B.3.6.1      Unquoted String Data
      B.3.6.2      Null Input
    B.3.7     User-Defined Functions (the DEF Statement)
    B.3.8     Built-In Functions
    B.3.9     Arrays

  B.4     Implementation-Defined Features
    B.4.1     Initial Values for Variables
    B.4.2     Retention of Long Strings
    B.4.3     Accuracy of Evaluation of Numeric Expressions
    B.4.4     Machine Infinitesimal
    B.4.5     Machine Infinity
    B.4.6     Precision For Numeric Values
    B.4.7     Exrad-Width For Printing Numeric Representations
    B.4.8     Significance-Width For Printing Numeric Representations
    B.4.9     Print Zone Length
    B.4.10    Margin for Output Line
    B.4.11    Pseudorandom Number Sequence
    B.4.12    Unique Line Numbers
    B.4.13    Input Prompt
    B.4.14    End of Input Reply
    B.4.15    End of Print Line
    B.4.16    Exponentiation Operator

  C   ASCII Character Codes

  D   VAX BASIC Keywords

  EXAMPLES

  1-1        Referencing Label Names in VAX BASIC Programs

  1-2        Using the DECLARE Statement to Set Array Boundaries

  1-3        Naming Constants Within a Program Unit

  1-4        Associating Values with Named Constants

  1-5        Naming Constants as Expressions

  1-6        Declaring Constants Outside the Program Unit

  1-7        Specifying a Comment Field

  1-8        Using Comments Fields to Format a Program

  1-9        Using Empty Statements in a VAX BASIC Program

  1-10       Using REM Statements in VAX BASIC Programs

  FIGURES

  1-1        Representation of the Subscript Variable A%(4%,6%)

  1-2        Truth Tables

  TABLES

  1-1        Keyword Space Requirements

  1-2        VAX BASIC Data Types

  1-3        Valid Floating-Point Variable Names

  1-4        Specifying Floating-Point Constants

  1-5        Numbers in E Notation

  1-6        Specifying Integer Constants

  1-7        Predefined Constants

  1-8        Arithmetic Operators

  1-9        Result Data Types in VAX BASIC Expressions

  1-10       VAX BASIC Result Data Types

  1-11       Result Data Types for DECIMAL Data

  1-12       Numeric Relational Operators

  1-13       String Relational Operators

  1-14       Logical Operators

  1-15       Numeric Operator Precedence

  2-1        Multiplying a Numeric Value with the SCALE Command

  4-1        VAX BASIC Parameter-Passing Mechanisms

  4-2        FILL Item Formats and Storage Allocations

  4-3        EDIT$ Values

  4-4        MAGTAPE Functionality in VAX BASIC

  4-5        Rounding and Truncation of 123456.654321

  4-6        VAX BASIC STATUS Bits

  4-7        TIME Function Values

  A-1        MAGTAPE Functionality in VAX BASIC

  A-2        RSTS/E Disk MODE Values and Corresponding BASIC Statements

  A-3        VAX BASIC Subset of RSTS/E SYS Calls

  A-4        VAX BASIC Subset of RSTS/E FIP SYS Calls

  A-5        Fatal Errors in VAX BASIC that are Warnings in BASIC-PLUS-2

  A-6        VAX BASIC and BASIC-PLUS-2 TIME Function Differences

  C-1        ASCII Characters Reserved for National Use

  C-2        ASCII Codes