GW-BASIC User's Guide
For further information about these statements and other statements, functions, commands, and
variables mentioned in this text, refer to the GW-BASIC User's Reference.
Some examples of redirection follow.
GWBASIC MYPROG >DATA.OUT
Data read by the INPUT and LINE INPUT statements continues to come from the keyboard. Data
output by the PRINT statement goes into the data.out file.
gwbasic MYPROG <DATA.IN
Data read by the INPUT and LINE INPUT statements comes from data.in. Data output by PRINT
continues to go to the screen.
gwbasic MYPROG <MYINPUT.DAT >MYOUTPUT.DAT
Data read by the INPUT and LINE INPUT statements now come from the file myinput.dat, and
data output by the PRINT statements goes into myoutput.dat.
gwbasic MYPROG <\SALES\JOHN\TRANS.DAT >>\SALES\SALES.DAT
Data read by the INPUT and LINE INPUT statements now comes from the file \sales\john\trans.
dat. Data output by the PRINT statement is appended to the file \sales\sales.dat.
2.4 GW-BASIC Statements, Functions, Commands, and Variables
A GW-BASIC program is made up of several elements: keywords, commands, statements,
functions, and variables.
2.4.1 Keywords
GW-BASIC keywords, such as PRINT, GOTO, and RETURN have special significance for the GW-
BASIC Interpreter. GW-BASIC interprets keywords as part of statements or commands.
Keywords are also called reserved words. They cannot be used as variable names, or the system
will interpret them as commands. However, keywords may be embedded within variable names.
Keywords are stored in the system as tokens (1- or 2-byte characters) for the most efficient use of
memory space.
2.4.2 Commands
Commands and statements are both executable instructions. The difference between commands
and statements is that commands are generally executed in the direct mode, or command level of
the interpreter. They usually perform some type of program maintenance such as editing, loading,
or saving programs. When GW-BASIC is invoked and the GW-BASIC prompt, Ok, appears, the
file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/Chapter%202.html (5 of 8)28/03/2004 21.28.57