Previous | Contents | Index |
VAX BASIC allows you to enter comments into the VAX BASIC Environment by specifying an exclamation point. Any text that follows the exclamation point (!) is treated as a comment. For example:
$ TYPE build_special.com $ SET VERIFY $ BASIC |
!+ ! Set the compilation unit options by uncommenting ! the appropriate ones !- !SET LIST SET WORD SET DEBUG !+ ! Get the source module. !- OLD SPECIAL !+ ! Compile it. !- COMPILE !+ ! All done. !- EXIT |
You can enter DCL commands while in the VAX BASIC Environment. To do so, precede each DCL command with a dollar sign ($). VAX BASIC passes the command to DCL for execution. The program currently in memory does not change.
VAX BASIC starts a subprocess to execute the command, and the
command executes in the context of that subprocess. This can sometimes
produce unexpected results. For example, entering the SET DEFAULT
command sets the default for the subprocess but not for the process in
which VAX BASIC executes. The newly set default exists only until
control returns to VAX BASIC.
2.5.3 APPEND Command
The APPEND command merges a VAX BASIC source program with the program currently in memory. The program in memory must be a VAX BASIC source program that has been placed in memory with the OLD command or entered in the Environment. The program must also contain at least one line number.
If both programs contain a line with the same number, the appended program line replaces the current program line.
If you type APPEND without specifying a file name, VAX BASIC prompts with:
Append file name-- |
You should respond with a file name. If you respond by pressing Return, VAX BASIC searches for a file called NONAME with the default file type of .BAS. If the compiler cannot find the file, it signals an error.
The APPEND command does not change the name of the program in memory.
2.5.4 ASSIGN Command
The ASSIGN command equates a logical name to a complete file specification, a device, or another logical name.
If the logical name translates to a device name and is used in place of a device name in a file specification, end the equivalence name with a colon.
The following example uses the ASSIGN command to make the system HELP library available from within VAX BASIC:
Ready ASSIGN SYS$HELP:HELPLIB HLP$LIBRARY |
The ASSIGN command does not support search lists. To assign a logical name to a search list from within the Environment, use the system command to execute the DCL command ASSIGN with the /JOB qualifier. For example:
$ ASSIGN/JOB DUA0:[MR.X],DUA0:[MR.Y] TWO$DIRECTORIES: |
When compiling a program in the VAX BASIC Environment, there are three levels at which you can specify options for the compiler:
The COMPILE command creates an object module from a source program in memory. You can control the compilation of your program with the COMPILE command and its qualifiers. These qualifiers duplicate many of the qualifiers available to the DCL command BASIC. You can abbreviate all COMPILE qualifiers to four letters. For example, you can compile a program currently in memory and specify the creation of a listing file:
COMPILE/LIST |
The following two commands both specify that a listing file is created. Note that the SET command sets a particular default until you leave the VAX BASIC Environment or until you specify a different default for that value, and the qualifiers to the COMPILE command set the defaults only for that particular compilation.
SET/LIST COMPILE/LIST |
If you do not specify any qualifiers with the SET command, VAX BASIC resets the defaults to the values that were in effect when you entered the VAX BASIC Environment.
The qualifiers to the COMPILE command are shown in the following list. Note that you can also use these qualifiers with the SET command to establish compiler options. The qualifiers are described fully in the Compaq BASIC for OpenVMS Alpha and VAX Systems Reference Manual.
If you use these qualifiers with the COMPILE command, the VAX BASIC Environment default values remain the same, but your program is compiled using the qualifiers and values you specify. When you use these qualifiers with the SET command, you set the defaults while you are in the VAX BASIC Environment. You can also set compiler options from inside the source program by using the OPTION statement. See the Compaq BASIC for OpenVMS Alpha and VAX Systems Reference Manual for more information about the OPTION statement.
If you specify the /DIAGNOSTICS qualifier or the /ANALYSIS_DATA
qualifier with the BASIC command, then make changes to a program and
attempt to compile the program before saving or replacing it,
VAX BASIC signals the error "Unsaved changes, no diagnostics
file produced" or "Unsaved changes, no analysis file
produced." You must save or replace the program before you compile
it to generate a diagnostics or data analysis file.
2.5.6 CONTINUE Command
The CONTINUE command resumes program execution after VAX BASIC
encounters a STOP statement or a Ctrl/C. After a STOP statement or a
Ctrl/C is encountered, you can enter immediate mode statements to
display or change program variables. Enter CONTINUE to resume execution
with the new values.
2.5.7 DELETE Command
The DELETE command removes a specified line or lines from the source program currently in memory. If you separate line numbers with commas, VAX BASIC deletes only the specified program lines. If you separate line numbers with a hyphen (-), VAX BASIC deletes the specified program lines and all program lines between them. For example:
DELETE 10 | Removes line 10 from the program |
DELETE 50, 100 | Removes lines 50 and 100 from the program |
DELETE 50, 100-190 | Removes line 50 and lines 100 to 190 from the program |
If you do not specify a line number, the DELETE command is ignored.
2.5.8 EDIT Command
The EDIT command replaces text in the current program with text you supply in the command. If you type EDIT with no argument, VAX BASIC invokes a text editor and reads the current program into the editor's buffer.
Table 2-2 shows examples of editing in line mode.
EDIT 100 /LEFT$/RIGHT$/ | Replaces the first occurrence of LEFT$ with RIGHT$ on line 100. |
EDIT | Invokes the default editor and reads the current program into the editor's buffer. |
EDIT 2000 | Lists line 2000 (line 2000 becomes the default EDIT line). |
EDIT 30 /LEFT$/RIGHT$/,3 | Starts the search on the third text line of program line 30 and replaces the first occurrence of LEFT$ with RIGHT$. |
EDIT 300/LEFT$//2 | Removes the second occurrence of the string LEFT$ from line 300. Note that you must specify delimiters around the null replacement string; otherwise, the EDIT command replaces the first occurrence of LEFT$ with 2. |
Entering EDIT with no argument instructs VAX BASIC to save your program temporarily in a file called BASEDITMP.BAS. The editor is then invoked and you can edit the program. Exiting from the editor causes the changed program to become the current program. VAX BASIC then displays the Ready prompt.
VAX BASIC deletes all versions of BASEDITMP.BAS when control returns from the editor. |
VAX BASIC supports the following callable text editors:
The default editor for VAX BASIC is EDT. In DCL, you can override this default by defining the logical name BASIC$EDIT. To find out if a system assignment exists, enter the following DCL command:
$ SHOW LOGICAL BASIC$EDIT |
The name you assign to BASIC$EDIT must be in the form nnn$EDIT, (nnn represents the acronym for the editor). For example, you can assign LSE to be the default editor with the following command:
$ ASSIGN "LSE$EDIT" BASIC$EDIT |
If the translation of BASIC$EDIT does not conform to nnn$EDIT,
VAX BASIC creates a temporary file containing your source code and
spawns a subprocess. VAX BASIC passes the translation of BASIC$EDIT
to the subprocess.
2.5.9 EXIT Command
The EXIT command clears memory and returns control to DCL command
level. If you modify a program and enter the EXIT command before you
copy it to disk with the SAVE or REPLACE command, VAX BASIC signals
"Unsaved change has been made, Ctrl/Z or EXIT to exit." This
message warns you that any changes will be lost if you do not save the
program. You can then store the program or reenter the EXIT command (or
press Ctrl/Z) to exit from VAX BASIC.
2.5.10 HELP Command
The HELP command lets you display the contents of the VAX BASIC HELP library. A list of commands and language topics for which there is help available is displayed. You are prompted to name a command or topic with the following prompt:
Topic? |
To obtain help on the Environment commands, enter COMMANDS at the Topic? prompt. A list of commands is displayed on your terminal followed by the prompt COMMANDS Subtopic?. When you type a command name in response to this prompt, the HELP facility displays the following:
You can also display help text for VAX BASIC errors. The help texts for the VAX BASIC error messages are grouped under two categories: compile-time errors and run-time errors. A run-time error refers to any error that occurs during program execution. All other errors are referred to as compile-time errors. Entering HELP RUN displays a list of the 3- to 9-character error mnemonics for the VAX BASIC list of run-time errors, and entering HELP COMPILE displays a list of the 3- to 9-character compile-time error mnemonics.
For example, if your program invokes a user-defined DEF function with a null argument, this causes VAX BASIC to signal the following error message:
%BASIC-E-ACTARGMUS, actual argument must be specified |
You display the help text by entering the following command:
HELP COMPILE ACTARGMUS |
The following text displays on your screen:
ACTARGMUS ERROR - A DEF function reference contains a null argument, for example FNA(1,,2). Specify all arguments when referencing a DEF function. |
You can access run-time errors with either the mnemonic or the error number. You specify the error number with the letters "ERR" followed by the error number. For example, you can display the HELP text for the end-of-file error by using the mnemonic as follows:
HELP RUN ENDFILDEV |
If you know only the error number, enter the following:
HELP RUN ERR11 |
VAX BASIC displays the appropriate mnemonic for that error.
2.5.11 IDENTIFY Command
The IDENTIFY command prints a header containing the VAX BASIC compiler name and version number. For example:
IDENTIFY VAX BASIC Vn.n Ready |
The LIST and LISTNH commands display a specified line or lines. If you type LIST or LISTNH without specifying line numbers, VAX BASIC displays a copy of the source program currently in memory, in ascending line number order.
The LIST command prints a header displaying the program name and the current time and date before displaying the specified lines. The LISTNH command suppresses the header information and prints the specified lines only. For example:
LIST 10 | Displays header information, then displays line 10 |
LISTNH 50, 100 | Displays lines 50 and 100 |
LIST 50, 90, 100-190 | Displays header information, then displays lines 50, 90, and 100 to 190 |
The LOAD command makes an object module available for execution with the RUN command. You can only load object files created by VAX BASIC.
The LOAD command accepts multiple device, directory, and file specifications. The LOAD command deletes all previously loaded object files; therefore, to load several files at the same time, you must separate the file specifications with a plus sign (+). Multiple file specifications separated with commas cause each file to be loaded separately, thereby deleting the previously loaded file.
If you do not specify any file specification, the LOAD command erases any previously loaded object files.
LOAD OLD1 + OLD2 + OLD3 Ready RUN |
The previous example loads the files OLD1.OBJ, OLD2.OBJ, and OLD3.OBJ for execution. These object files are not linked with the current program or executed until you issue the RUN command. Therefore, run-time errors in the loaded modules are not detected until you execute the program.
Each device and directory specification applies to all following file specifications until you specify a new directory or device. For example:
LOAD DUA1:[SMITH]PROG3+[JONES]PROG4+DUA2:PROG5 |
This command loads three object files:
Previous | Next | Contents | Index |