BASIC-SO

Commands and Statements

ERROR expression

10 INPUT A,B,C

12IF B=O THEN ERROR 11

14PRINT AlB

20END

RUN

? 40,0,17

DIVISION BY ZERO IN 12 Ok

EXIT

The EXIT command terminates operation of the BASIC-80 interpreter and returns control to ISIS-II. EXIT closes all open files, but does not automatically save pro- grams. If you EXIT without saving the current program, it will be lost.

EXIT

FIELD

The FIELD statement is used to allocate space within one of six 128-byte BASIC-80 random file buffers. When a random 110 transaction occurs, data move to or from the specified random file buffer to or from disk sectors. The FIELD statement associates the data with its position in the 110 buffer so that future references to the specified variable will access the proper string characters or numbers within the record stored in the random file buffer. The example below shows how FIELD is used. For further information, refer to the BASIC-80 Disk Input/Output section.

FIELD # file number,

number of characters AS string variable

[,number of characters AS string variable] ...

The program below opens random file :F1 :FILE.1 and asks for five 30-character strings to insert into :Fl :FILE.1.

10OPEN "R" ,#1, ":F1 :FILE.1"

20FIELD #1,30 AS A$

30FOR 1=1 to 5

40INPUT Z$

50LSET A$ = Z$

60PUT#1,1

70NEXT I

80CLOSE#1

90END

FOR-NEXT-STEP

The FOR-NEXT statement allows the execution of a given group of lines a given number of times. As shown in the example below, on each iteration of the routine, value A is incremented by the value given in the STEP instruction. If no value for STEP is specified, the increment is 1. The instruction lines following the line con- taining the FOR instruction are executed until the NEXT instruction is encountered. Program control returns to the FOR instruction line, STEP is added to the value of A, and the routine is reentered. When variable A exceeds the TO expression, control passes to the instruction line following the NEXT instruction line.

6-7

Page 47
Image 47
Intel 9800758-02 Exit, For-Next-Step, Error expression, Field # file number Number of characters AS string variable