5.1.2 Programs without Line Numbers
If you do not use line numbers in your program, follow these
rules:
.
Use a text editor to enter and edit the program; you can-
not enter programs without line numbers directly in the
environment.
.
No line numbers are allowed anywhere in the program
module.
.
The ERL functions is not allowed.
.
REM statements are not allowed.
.
In VAX BASIC, other files cannot be appended, because
appended files must contain at least one line number.
Note that in a multiple-unit program without line num-
bers, any comments following an END, END SUB, or END
FUNCTION statement become a part of the next subpro-
gram during compilation (unless there is no next subpro-
gram). This is not the case in multiple-unit programs with
line numbers.
Note that you can avoid all of these restrictions by placing a
line number on the first line of your program; no additional
line numbers are required. The line number on the first pro-
gram line causes the compiler to compile your program as a
program with line numbers.
When you enter a program with or without line numbers,
you can begin your program statements in the first character
position on a line. While these statements would be consid-
ered immediate mode statements if entered in the BASIC
environment, they are valid in a program that is created
with a text editor.
For example, you can enter the following program directly
into the environment:
10 !This is a short program that you can enter
!and run in the BASIC environment
!
PRINT "This program will convert pound weight to kilograms"
INPUT "How many pounds";A
!Here is the conversion step
B = A * 2.2
PRINT "For ";A;" pounds, the kilogram weight is ";B
END
Output
This program will convert pound weight to kilograms
How many pounds? 10
For 10 pounds, the kilogram weight is 22
To develop the following program, you have to use a text
editor, and you must observe the restrictions previously listed:
!This is a short program that does not contain any
!BASIC line numbers.
!This program must be entered using a text editor;
!it cannot be entered directly into the environment.
!
PRINT "This program converts kilogram weight to pounds"
INPUT "How many kilograms";A
!This is the conversion factor
B = A / 2.2
PRINT "For ";A;" kilograms, the pound weight is ";B
END
Output
This program converts kilogram weight to pounds
How many kilograms? 11
For 11 kilograms, the pound weight is 5
Note that you can use exclamation comment fields instead of
REM statements to insert comments into programs without
line numbers. An exclamation point in column 1 in the envi-
ronment causes the BASIC compiler to ignore the rest of the
line. You can also identify program statements in programs
without line numbers by using labels.