
Disk Memory System
The next section, lines
1000
through
1060,
prints the entire file in sequential order.
1 000 REM PRINT A FILE
1 01 0 RESTORE #2,REC 1
1 020 FOR COUNT
=
1 TO TOTAL
1 030 INPUT #2:BUFFERiB
1 040 PRINT COUNT;BUFFERiB
1 050 NEXT COUNT
1 060 GOTO 220
The next section, lines
2000
through
2040,
prints a specific record.
2000 REM PRINT A RECORD
201 0 GOSUB 1 0000
2020 INPUT #2,REC RECNUM:BUFFERiB
2030 PRINT RECNUM;BUFFERiB
2040 GOTO 220
The next section, lines
3000
through
3040,
allows a record to be changed.
3000 REM CHANGE A RECORD
301 0 GOSUB 1 0000
3020 INPUT "ENTER NEW DATA? " :BUFFERiB
3030 PRINT #2,REC RECNUM:BUFFERiB
3040 GOTO 220
The following section, lines
4000
through
4050,
allows a record to be added.
4000 REM ADD RECORD
401 0 IF TOTAL
=
50 THEN 21 0
4020 TOTAL
=
TOTAL
+
1
4030 INPUT "ENTER DATA? " : BUFFERiB
4040 PRINT #2,REC TOTAL: BUFFERiB
4050 GOTO 220
Lines
5000
through
5020
close the file at the end of the program.
5000 REM LEAVE THE PROGRAM
501 0 CLOSE #2
5020 END
The last section, lines
10000
through
10050,
is a subroutine used for user Input of a
record number.
1 0000 INPUT "WHICH RECORD? ":RECNUM
1 001 0 IF RECNUM < 1 THEN 1 0030
1 0020 IF RECNUM <
=
TOTAL THEN 1 0050
1 0030 PRINT "INVALID RECORD NUMBER"
1 0040 GOTO 1 0000
1 0050 RETURN
39
Содержание PHP1240
Страница 1: ......