|
STATUS
Abbreviation: ST
STATUS
TYPE: Integer Function
FORMAT: STATUS
Action: Returns a completion STATUS for the last input/output
operation which was performed on an open file. The STATUS can
be read from any peripheral device. The STATUS (or simply ST)
keyword is a system defined variable-name into which the KERNAL
puts the STATUS of I/O operations. A table of STATUS code values
for tape, printer, disk and RS-232 file operations is shown below:
| ST Bit Position |
ST Numeric Value |
Cassette Read |
Serial Bus R/W |
Tape Verify + Load |
| 0 |
1 |
|
time out write |
|
| 1 |
2 |
|
time out read |
|
| 2 |
4 |
short block |
|
short block |
| 3 |
8 |
long block |
|
long block |
| 4 |
16 |
unrecoverable read error |
|
any mismatch |
| 5 |
32 |
checksum error |
|
checksum error |
| 6 |
64 |
end of file |
EOI |
|
| 7 |
-128 |
end of tape |
device not present |
end of tape |
EXAMPLES of STATUS Function:
10 OPEN 1,4:OPEN 2,8,4,"MASTER FILE,SEQ,W"
20 GOSUB 100:REM CHECK STATUS
30 INPUT#2,A$,B,C
40 IF STATUS AND 64 THEN 80:REM HANDLE END-OF-FILE
50 GOSUB 100:REM CHECK STATUS
60 PRINT#1,A$,B;C
70 GOTO 20
80 CLOSE1:CLOSE2
90 GOSUB 100:END
100 IF ST > 0 THEN 9000:REM HANDLE FILE I/O ERROR
110 RETURN
|