Purpose Syntax

by • 03/07/2012 • New Pattern Computer NotesComments (0)672

Purpose To generate line numbers automatically.
Syntax AUTO [<line number>][,[<increment>]]line number       is the line number AUTO begin?, numbering.

Increment        is the value AUTO uses to add Io present line number to get the next line number in the sequence.

Comments When AUTO command is entered, It displays first line number in sequence a following space then wails for you to enter a program line. When you entered your program  line and press <Enter>  key,  AUTO displays next number with a following space. The next line number is equal to last line number plus increment. To exit AUTO mode and return to command level press <Ctrl>/<Break> key sequence.
e.g AUTO              Generates line numbers 10, 20, 30, …..AUTO 10, 5      Generates line numbers 10, 15, 20, …..

AUTO 2                       Generates line number 0, 2, 4,……

DELETE To delete program lines from memory.
Syntax DELETE [<start line> ][- [<end line> ]]Start line         is the line number of first line to be deleted.

End line                       is the line number of last line to be deleted.

Comments The DELETE command deletes a specified line or range of lines from the program currently in memory.
e.g DELETE 100     Deletes line number 100 from the program in memoryDELETE 50-90 Deletes line number 50 through 90.

DELETE – 80    Deletes all line in the range 0 to 80, inclusive

DELETE 200 –  Deletes all lines from line 200 to the end of program.

Purpose To enter the edit mode at a specified line number
Syntax EDIT <line number>Line number    is a valid line number in a program
Comments The EDIT command displays specified line and then positions the cursor under first digit of line. You can then use editing keys of program editor to make changes as needed.
e.g EDIT 150         Displays line number 150 and allows to edit
Note The LIST command may also be used for the same purpose.
Purpose To display the available file name(s) from a disk
Syntax FILES [“<filespec>”]Filespec                       is a string expression indicating a file. If a filespec is omitted, all files in

current directory on default disk are displayed.

Comments All files with file names matching a file name in filespec are displayed. The file name may contain “?” and “*” wildcard characters directory on default drive.
e.g FILES                Displays all file name(s) in current directory on default driveFILES “*.BAS”   Displays all files having BAS extension

FILES “B:          Displays all file on drive B

Purpose To delete a file from disk
Syntax KILL “<filespec>”Filespec                       is a valid file name
Comments The KILL command can be used to delete all types of disk files. It may contain wildcard characters.
e.g KILL “BIO-DATA.BAS” To delete a file named BIO-DATA.BAS.KILL “*.BAS”                To delete all files which have BAS extension.

KILL “B:MY-FILE”         To delete file MY-FILE (without extension) in drive B.

Purpose To list all or a part of the program currently in memory on screen.
Syntax LIST [<start line>][-[<end line>]]start line          indicates start line number to be listed.

end line                       indicates last line number to be listed.

Comments If the LIST is entered without any option, the entire program currently in memory is listed on screen. The <Ctrl>/<Num Lock> key sequence can be used to stop or pause the listing, allowing to look at lines on screen. Press any key to continue with listing. To interrupt listing and return to command level, press the <Ctrl>/<Break> key sequence.
e.g LIST                 To list entire program “currently in memory.LIST 100-200   To list a program lines between 100 to 200, inclusive.

LIST 50-                       Lists all lines from 50 to the end of program.

LIST -100         Lists from the beginning of program to line 100.

Purpose To list all or a part of program currently in memory on the printer.
Syntax LLIST [<start line>][-[<end line]]start line          indicates start line number to be listed,

end line                       indicates last line number to be listed.

Comments The LLIST command is used to take a list of program on paper. The start line and end line option’s work same as described in LIST command.
e.g LLIST                To list entire program currently in memory on printer.’LLIST 100-200-            To list a program lines from 100 to 200 on printer.

LLIST 50-         Lists all lines from 50 to the end of program.

LLIST -100       Lists from the beginning of program to line 100.

Purpose To load a file from disk into memory and optionally execute it.
Syntax LOAD “<filespec”[,R]filespec                       is a name of disk file to be loaded.
Comments If in <filespec> a filename extension is not included GWBASIC assumes an extension of BAS. LOAD, closes all open files and deletes all variables and program lines currently residing In memory before it loads the new program.-If the R option is added, the program is automatically executed after it has been loaded.
e.g LOAD “SALARY.BAS”  Loads SALARY.BAS from default drive.LOAD “B:SALARY        LOAD ‘SALARY.BAS”.R from drive B.

Loads SALARY.BAS    Loads and run the program automatically.

Purpose To change the name of a disk file.
Syntax NAME “<old filcspec>” AS “<new filespec>”old filespec        is current file name.

new filespec      is new file name.

Comments The NAME command does not move the file. The file will exist on same drive and in same area on disk, with new file name.
e.g NAME “SALARY.BAS” AS “PAY-ROLBAS”In this example, the file SALARY.BAS is renamed as PAY-ROL.BAS on default drive.
Purpose To delete program currently in memory and clear all variables.
Syntax NEW
Comments The NEW command is usually entered in direct mode to clear memory before entering the lines of new program.
e.g NEW
Purpose To renumber program lines.
Syntax RENUM U<new number>][,[<old number>][,<increment>]]]new number      is first line number to be used in sequence. The default is 10.

old number        is line number in current program where renumbering is to begin. The

default is first line of program,

increment        is the increment to be used in new sequence. The default is .10.

Comments The RENUM command is used 10 renumber the program Tines currently in-memory. RENUM also changes, all line number references following GOTO, GOSUB. IF…THEN./.ELSE. ON…GOTO, ON…GOSUB. RESTORE, RESUME and ERL statements to reflect new line numbers.
e.g RENUM                                   Renumbers entire program. The first new line number will be 10and next line will be incremented by 10.

RENUM 200.,5                         Renumbers entire program. The first new line is 200 and line

numbers are incremented by 5.

RENUM 2000,100,50   Renumbers lines from 100, so they start with line number 2000

and increment line numbers by 50.

Purpose To execute the program from memory or disk.
Syntax RUN [<line number>]RUN tt<filespec>”

line number       is a line number to start execution at.

filespec                       is a string expression indicating a file to be loaded and run.

Comment RUN starts the execution of program. If <line number> is specified, execution begins on that line of program. Otherwise, execution begins, at first line. RUN <filespec> loads the program from disk into, memory and starts execution from first line number.
e.g RUN                             Starts the execution from first line of program.RUN 100                      Starts the execution from line number 100.

RUN “SALARY.BAS”    Loads the program SALARY.BAS from disk and executes it from

first line of program.

Purpose To save a program file on disk.
Syntax SAVE “<filespec>”[,{A|P}|filespec                       is any valid file name.
Comments This command saves the program currently in memory as a disk file. If a file name extension is not included GWBASIC appends the .BAS extension. If a file currently exist on disk with same file name GWBASIC write the new file over the old file. The A option saves file in ASCII format. The P. option protects the file by saving it in an encoded binary format, so it cannot be listed.
e.g SAVE “RESULT”                                   This command writes the program from memory on thedefault drive as RESULT.

SAVE “B:ACCOUNT.BAS”,A     This command saves program currently-in memory on

drive B as ACCOUNT.BAS in ASCII format.

SAVE “C:BANK                                    A File is saved in drive C as BANK.BAS.

Purpose To close all open files and return control to DOS.
Comments When a SYSTEM command is executed. GWBASIC closes all files that are open and returns to operating system.


Pin It

Leave a Reply