User`s manual
that you have no way of keeping track of which blocks on the disk you used.
After all, you can't tell one used block on the BAMfrom another. You can't tell
whether it contains your random file, just part of a program, or even sequential
or relative meso
To keep track, the most common method is to build up a sequential file to
go with each random file. Use this file to keep just a list of record, track, and
block locations. This means that there are 3 channels open to the disk for each
random me: one for the command channel, one for the random data, and the
other for the sequential data. This also means that there are 2 buffers that you're
filling up at the same time!
SAMPLE PROGRAM WRITING 10 RANDOM-ACCESS BLOCKS WITH
SEQUENTIALFILE: .
10 OPEN 15,8,15
20 OPEN 5, 8, 5, "#
30 OPEN 4,8,4, "@O:KEYS,S,W"
40 A$= "Record Contents #"
50 FOR R=l TO 10
70 PRINT# 5, A$ "," R
90 T=I: S=1
100 PRINT# 15, "B-A:" 0, T, S
110 INPUT# 15, A, B$, C, D
120 IF A=65 THEN T=C: S=D: GOTO 100
130 PRINT# 15, "B-W:" 5, 0, T, S
140 PRINT# 4, T "," S
150 NEXT R
160 CLOSE4: CLOSE 5: CLOSE 15
SAMPLE PROGRAM READING BACK 10 RANDOM-ACCESS BLOCKS WITH
SEQUENTIAL FILE:
10 OPEN 15,8,15
20 OPEN 5, 8, 5, "#"
30 OPEN4, 8, 4, "KEYS,S,R"
40 FOR R=1 TO 10
~
50 INPUT# 4, T, S
60 PRINT# 15, "B-R:" 5, 0, T, S
Finds Next Track
& Sector Used
30