Compaq BASIC for OpenVMS
Alpha and VAX Systems
Reference Manual


Previous Contents Index

If you specify the DECLINING clause, VAX BASIC flags the following source code as declining:

The default is /NOFLAG.


The /GFLOAT qualifier causes VAX BASIC to allocate 64 bits of storage in G_floating format as the default size for all floating-point data not explicitly typed in the program. Untyped floating-point values are treated as G_floating values and must be in the G_floating range or VAX BASIC signals "Floating-point error or overflow." Table 1-2 lists VAX BASIC data types and ranges. The default is /SINGLE.


The /HFLOAT qualifier causes VAX BASIC to allocate 128 bits of storage in H_floating format as the default size for all floating-point data not explicitly typed in the program. Untyped floating-point values are treated as H_floating values and must be in the H_floating range or VAX BASIC signals "Floating-point error or overflow." Table 1-2 lists VAX BASIC data types and ranges. The default is /SINGLE.


The /LINES qualifier includes line number information in object modules. If you specify /NOLINES, VAX BASIC does not include line number information in object modules.

In VAX BASIC, if you specify /NOLINES in a program containing a RESUME statement or the run-time ERL function, VAX BASIC issues a warning that the /NOLINES qualifier has been overridden. Alpha BASIC does not issue a warning message but turns on /LINES.

In Alpha BASIC, the default is /NOLINES.

In VAX BASIC, the default is /LINES.


The /LIST qualifier causes VAX BASIC to produce a compiler listing file. This compiler listing contains a memory allocation map. By default, the name of the listing file is the same as the name of the first program module specified, and has a default file type of .LIS. If you specify /NOLIST, VAX BASIC does not generate a compiler listing. The default is /NOLIST.


The /LONG qualifier causes VAX BASIC to allocate 32 bits of storage as the default size for all integer data not explicitly typed in the program. Untyped integer values are treated as LONG values and must be in the LONG range or VAX BASIC signals the error "Integer error or overflow." Table 1-2 lists VAX BASIC data types and ranges. The default is /LONG.


When you specify the /MACHINE_CODE qualifier with the /LIST qualifier in the COMPILE command, VAX BASIC includes the machine code generated by the compilation in the program listing file. If you specify /NOMACHINE_CODE, VAX BASIC does not include a machine code section in the listing file. The default is /NOMACHINE_CODE.


The /OBJECT qualifier generates an object module with the same file name as the program and a default file type of .OBJ. The /NOOBJECT qualifier allows you to check your program for errors without creating an object file. The default is /OBJECT.


The /OVERFLOW qualifier causes VAX BASIC to report arithmetic overflow for operations on integer or packed decimal data, or both. If you specify /NOOVERFLOW, VAX BASIC does not report arithmetic overflows. The default is /OVERFLOW=(INTEGER,DECIMAL).


The /ROUND qualifier causes VAX BASIC to round rather than truncate DECIMAL values. If you specify /NOROUND, VAX BASIC truncates DECIMAL values. The default is /NOROUND.

/ROUND also causes the INTEGER function to round its argument instead of truncating it.


The /SETUP qualifier causes VAX BASIC to make calls to the Run-Time Library to set up the stack for VAX BASIC variables, set up dynamic string and array descriptors, initialize variables, and enable VAX BASIC error handling. If you specify the /NOSETUP qualifier, the compiler will attempt to optimize your program by omitting these calls. If your program contains any of the following elements, VAX BASIC provides an informational diagnostic and does not optimize your program:

Note that program modules compiled with the /NOSETUP qualifier cannot perform I/O and have no error-handling capabilities. If an error occurs in such a module, the error is resignaled to the calling program. The default is /SETUP.


The /SHOW qualifier (when used with the /LIST qualifier) tells VAX BASIC what to include in the compiler listing file. You can specify the following /SHOW qualifier items:

For example, if you specify the following command, VAX BASIC includes a storage allocation map section in the compiler listing:


COMPILE/LIST/SHOW=MAP 

If you specify a /SHOW qualifier but do not specify any /SHOW items, VAX BASIC includes all the aforementioned sections in the listing. If you specify /NOSHOW, VAX BASIC does not add any additional sections to the compiler listing. The default is /SHOW.


The /SINGLE qualifier causes VAX BASIC to allocate 32 bits of storage in F_floating format as the default size for all floating-point data not explicitly typed in the program. Untyped floating-point values are treated as SINGLE values and must be in the SINGLE range or VAX BASIC signals the error "Floating-point error or overflow." Table 1-2 lists VAX BASIC data types and ranges. The default is /SINGLE.


The /SYNTAX_CHECK qualifier causes VAX BASIC to perform syntax checking after each program line is typed. If you specify /NOSYNTAX_CHECK, VAX BASIC does not perform syntax checking after each program line is typed. The default is /NOSYNTAX_CHECK.


The /TRACEBACK qualifier causes VAX BASIC to include traceback information in the object file that allows reporting of the sequence of calls that transferred control to the statement where an error occurred. The /NOTRACEBACK qualifier tells VAX BASIC not to include traceback information in the object file. The default is /TRACEBACK.


The /TYPE_DEFAULT qualifier sets the default data type (REAL, INTEGER, or DECIMAL) for all data not explicitly typed in your program or specifies that all data must be explicitly typed (EXPLICIT). The following list describes the /TYPE_DEFAULT variables:

The default is TYPE_DEFAULT=REAL.


The /VARIANT qualifier establishes int-const as a value to be used in compiler directives. The variant value can be referenced in a lexical expression with the lexical function, %VARIANT. Int-const always has a data type of LONG. The default is /VARIANT=0.


The /WARNINGS qualifier causes VAX BASIC to display warning or informational messages, or both. If you specify /WARNINGS but do not specify a warning clause, VAX BASIC displays both warnings and informational messages. If you specify /NOWARNINGS, VAX BASIC does not display warning and informational messages. The default is /WARNINGS.


The /WORD qualifier causes VAX BASIC to allocate 16 bits of storage as the default for all integer data not explicitly typed in the program. Untyped integer values are treated as WORD values and must be in the range -32768 to 32767 or VAX BASIC signals the error "Integer error or overflow." Table 1-2 lists VAX BASIC data types and ranges. The default is /LONG. In the following example, VAX BASIC compiles the program LETSGO and creates a new version of the object file as well as a listing file. In addition, VAX BASIC allocates 64 bits of storage in D_FLOAT format as the default for all floating point data not explicitly typed in the program.


Example


COMPILE LETSGO/DOUBLE/LIST 


CONTINUE

The CONTINUE command continues program execution after VAX BASIC executes a STOP statement or encounters a Ctrl/C.

Format



Syntax Rules

None


Remarks

  1. After a STOP statement or a Ctrl/C, you can enter immediate mode commands and resume program execution with the CONTINUE command.
  2. After a STOP statement or a Ctrl/C, you cannot resume program execution if you have made source code changes or additions.

Example


%BAS-I-STO, Stop 
-BAS-I-FROLINMOD, from line 25 in module ABC 
Ready 
 
CONTINUE 


DELETE

The DELETE command removes a specified line or range of lines from the program currently in memory.

Format



Syntax Rules

None


Remarks

  1. You cannot specify the DELETE command on programs that do not contain line numbers.
  2. The separator characters (comma or hyphen) allow you to delete individual lines or a block of lines under the following conditions:
  3. You can combine individual line numbers and line ranges in a single DELETE command. Note, however, that a line number range must be followed by a comma and not another hyphen, or VAX BASIC signals an error.
  4. VAX BASIC signals an error if there are no lines in the specified range or if you specify an illegal line number.

Examples

Example 1


DELETE 50 

Example 2


DELETE 70-80, 110, 124 

Example 3


DELETE 50,60,90-110 


EDIT

The EDIT command allows you to edit individual program lines in the VAX BASIC Environment while invoking an editor. Entering EDIT with no arguments invokes a text editor and reads the current program into the editor's buffer.

Format



Syntax Rules

  1. Line-num specifies the line to be edited.
  2. Search-clause specifies the text you want to remove or replace. Unq-str1 is the search string you want to remove or replace.
  3. Replace-clause specifies the replacement text and the occurrence of the search string you want to replace.
  4. Delim can be any printing character not used in unq-str1 or unq-str2. The examples for this command use the slash (/) as a delimiter.

Remarks

  1. The delim characters in search-clause must match, or VAX BASIC signals an error.
  2. If the delimiter you use to signal the end of replace-clause does not match the delimiter used in search-clause, VAX BASIC does not signal an error and treats the end delimiter as part of unq-str2.
  3. VAX BASIC replaces or removes text in a program line as follows:
  4. VAX BASIC displays the edited line with changes after the EDIT command successfully executes.
  5. If you specify a line number with no text parameters, VAX BASIC displays the line.
  6. The EDIT command followed by pressing Return causes VAX BASIC to save your current source file in BASEDITMP.BAS and automatically invokes EDT as the default text editor.
  7. At DCL level, you can override the default text editor. To do this, assign the logical name BASIC$EDIT to another editor such as TPU or the Compaq Language Sensitive Editor for OpenVMS (LSE) before entering the VAX BASIC Environment. In the following example, BASIC$EDIT is defined to be TPU$EDIT. The EDIT command followed by pressing Return then invokes TPU as the default text editor.


    $ DEFINE BASIC$EDIT TPU$EDIT
    

  8. If you define BASIC$EDIT to be an editor other than EDT, TPU, or LSE, VAX BASIC spawns a subprocess to invoke the editor assigned to BASIC$EDIT.
  9. When you finish editing your program and exit from the editor, the edited program is the program currently in memory, and the context of the VAX BASIC Environment is unchanged. Note that VAX BASIC deletes all versions of BASEDITMP.BAS when you return to VAX BASIC from the editor.

Example


Ready 
 
LIST 100 
 
100 NEW_STRING$ = LEFT$(STRING$,12) 
 
EDIT 100 /LEFT$/RIGHT$/3,2 
 
LIST 100 
 
100 NEW_STRING$ = RIGHT$(STRING$,12) 


EXIT

The EXIT command or Ctrl/Z clears the memory and returns control to the operating system.

Format



Syntax Rules

None


Remarks

If you enter EXIT after creating a new program or editing an old program without first entering SAVE or REPLACE, VAX BASIC signals "Unsaved change has been made, Ctrl/Z or EXIT to exit." The message warns you that the new or revised program will be lost if you do not Save or Replace it. If you enter EXIT again, VAX BASIC exits from the VAX BASIC Environment whether you have saved your changes or not.


Example


EXIT 
%BASIC-W-CHANGES, unsaved change has been made, Ctrl/Z or EXIT to exit 
Ready 
 
SAVE 
 
EXIT 
 
$ 
 
Ready 


HELP

The HELP command displays online documentation for VAX BASIC commands, keywords, statements, functions, and conventions.

Format



Syntax Rules

  1. Unq-str is a VAX BASIC topic, keyword, command, statement, function, or convention.
  2. The first unq-str must be one of the topics described in the HELP file. If it is not, VAX BASIC displays a list of topics for you to choose from.
  3. You can specify a subtopic after the topic. Separate one unq-str from another with a space.
  4. You can use the asterisk (*) wildcard character in unq-str. VAX BASIC then matches any portion of the specified topic.

Remarks

  1. If you type HELP with no parameters, VAX BASIC displays a list of statements, functions, compiler directives, compiler commands and language topics.
  2. If the unq-str you specify is not a unique topic or subtopic, VAX BASIC displays information about all topics or subtopics beginning with unq-str.
  3. An asterisk (*) indicates that you want to display information that matches any portion of the topic you specify. For example, if you type HELP GO*, VAX BASIC displays information about the GOSUB statement and the GOTO statement.
  4. When information about a particular topic or subtopic is not available, BASIC signals the message "Sorry, no documentation on unq-str" and provides a list of alternative HELP topics to choose from.

Example


Ready 
 
Help GO* 
 
GOSUB 
 
  The GOSUB statement transfers control to a specified line number or 
  label and stores the location of the GOSUB statement for eventual 
  return from the subroutine. 
 
  Example 
 
  200 GOSUB 1100 
 
  Additional information available: 
 
  Syntax 
 
GOTO 
 
  The GOTO statement transfers control to a specified line number or 
  label. 
 
  Example 
 
  20 GOTO 200 
 
  Additional information available: 
 
  Syntax 
 
Topic? 


IDENTIFY

The IDENTIFY command displays an identification header on the controlling terminal. The header contains the name and version number of VAX BASIC.

Format



Syntax Rules

None


Remarks

The message displayed by the IDENTIFY command includes the name of the VAX BASIC compiler and the version number. In the example, n represents the version and point release number.


Example


IDENTIFY 
 
VAX BASIC Vn.n


INQUIRE

The INQUIRE command is a synonym for the HELP command. See the HELP command for more information.

LIST and LISTNH

The LIST command displays the program lines of the program currently in memory. Line numbers are sequenced in ascending order. The LISTNH command displays program lines without the program header.

Format



Syntax Rules

A line-num followed by a hyphen (-) and the Return key displays the specified line and all remaining lines in the program.


Remarks

  1. The LIST command displays program lines, along with a header containing the program name, the current time, and the date. To suppress the program header, enter LISTNH.
  2. LIST without parameters displays the entire program.
  3. The separator characters (comma or hyphen) allow you to display individual lines or a block of lines.
  4. You can combine individual line numbers and line ranges in a single LIST command. Note, however, that a line number range must be followed by a comma and not another hyphen, or VAX BASIC signals an error.
  5. A hyphen between the list command and line-num causes VAX BASIC to signal an error.
  6. VAX BASIC displays the source program lines in the order you specify in the command line. VAX BASIC displays line 100 before line 10 if you enter LIST 100,10.

Example


LIST 200-300 

Output


200 %IF %VARIANT = 2 %THEN %ABORT 
300 %END %IF 


Previous Next Contents Index