10 REM PC-BASIC test
20 REM OPEN SYNTAX
30 OPEN "output.txt" FOR OUTPUT AS 1
40 ON ERROR GOTO 100
50 GOTO 200
100 PRINT#1, ERR, ERL
110 RESUME NEXT
200 REM old-style syntax
210 OPEN "R", 2, "or00": CLOSE #2
220 OPEN "R", #2, "or00": CLOSE #2
230 OPEN "R", 2, "or00", 128: CLOSE #2
235 OPEN "R", #2, "or00", 128: CLOSE #2
240 OPEN "O", 2, "oo00": CLOSE #2
250 OPEN "O", #2, "oo00": CLOSE #2
260 OPEN "O", 2, "oo00", 128: CLOSE #2
265 OPEN "O", #2, "oo00", 128: CLOSE #2
270 OPEN "I", 2, "oo00": CLOSE #2
280 OPEN "I", #2, "oo00": CLOSE #2
290 OPEN "I", 2, "oo00", 128: CLOSE #2
295 OPEN "I", #2, "oo00", 128: CLOSE #2
300 OPEN "A", 2, "oo00": CLOSE #2
310 OPEN "A", #2, "oo00": CLOSE #2
320 OPEN "A", 2, "oo00", 128: CLOSE #2
335 OPEN "A", #2, "oo00", 128: CLOSE #2
340 REM errors
345 OPEN "B", 2, "oe00"
350 OPEN "R", 2
355 OPEN "R",,"oe01"
1000 REM RANDOM
1030 OPEN "r01" AS 2: CLOSE 2
1040 OPEN "r02" AS #2: CLOSE 2
1050 OPEN "r03" FOR RANDOM AS 2: CLOSE 2
1055 OPEN "r04" FOR RANDOM AS #2: CLOSE 2
1060 OPEN "r05" for RANDOM AS 2 LEN=128: CLOSE 2
1070 OPEN "r06" for RANDOM AS #2 LEN=128: CLOSE 2
1080 OPEN "r07" FOR RANDOM ACCESS READ AS 2: CLOSE 2
1082 OPEN "r08" FOR RANDOM ACCESS WRITE AS 2: CLOSE 2
1085 OPEN "r09" FOR RANDOM ACCESS READ WRITE AS 2: CLOSE 2
1090 OPEN "r0a" for RANDOM SHARED AS 2: CLOSE 2
1090 OPEN "r0b" for RANDOM LOCK READ AS 2: CLOSE 2
1100 OPEN "r0d" for RANDOM LOCK WRITE AS 2: CLOSE 2
1100 OPEN "r0c" for RANDOM LOCK READ WRITE AS 2: CLOSE 2
1110 OPEN "r0d" FOR RANDOM ACCESS READ SHARED AS 2: CLOSE 2
1120 OPEN "r0e" FOR RANDOM ACCESS WRITE SHARED AS 2: CLOSE 2
1130 OPEN "r0f" FOR RANDOM ACCESS READ WRITE SHARED AS #2: CLOSE 2
1210 OPEN "r10" FOR RANDOM ACCESS READ LOCK READ AS 2: CLOSE 2
1220 OPEN "r11" FOR RANDOM ACCESS WRITE LOCK READ AS 2: CLOSE 2
1230 OPEN "r12" FOR RANDOM ACCESS READ WRITE LOCK READ AS #2: CLOSE 2
1240 OPEN "r13" FOR RANDOM ACCESS READ LOCK WRITE AS 2: CLOSE 2
1250 OPEN "r14" FOR RANDOM ACCESS WRITE LOCK WRITE AS 2: CLOSE 2
1260 OPEN "r15" FOR RANDOM ACCESS READ WRITE LOCK WRITE AS #2: CLOSE 2
1270 OPEN "r13" FOR RANDOM ACCESS READ LOCK READ WRITE AS 2: CLOSE 2
1280 OPEN "r14" FOR RANDOM ACCESS WRITE LOCK READ WRITE AS 2: CLOSE 2
1290 OPEN "r15" FOR RANDOM ACCESS READ WRITE LOCK READ WRITE AS #2: CLOSE 2
1300 REM not trying all combinations of this...
1310 OPEN "r16" FOR RANDOM ACCESS READ WRITE LOCK READ WRITE AS #2 LEN=128: CLOSE 2
1400 REM errors
1410 OPEN
1420 OPEN "r17"
1430 OPEN "r17" FOR RANDOM
2000 REM OUTPUT
2050 OPEN "o03" FOR OUTPUT AS 2: CLOSE 2
2055 OPEN "o04" FOR OUTPUT AS #2: CLOSE 2
2060 OPEN "o05" for OUTPUT AS 2 LEN=128: CLOSE 2
2070 OPEN "o06" for OUTPUT AS #2 LEN=128: CLOSE 2
2080 OPEN "o07" FOR OUTPUT ACCESS READ AS 2: CLOSE 2
2082 OPEN "o08" FOR OUTPUT ACCESS WRITE AS 2: CLOSE 2
2085 OPEN "o09" FOR OUTPUT ACCESS READ WRITE AS 2: CLOSE 2
2090 OPEN "o0a" for OUTPUT SHARED AS 2: CLOSE 2
2090 OPEN "o0b" for OUTPUT LOCK READ AS 2: CLOSE 2
2100 OPEN "o0d" for OUTPUT LOCK WRITE AS 2: CLOSE 2
2100 OPEN "o0c" for OUTPUT LOCK READ WRITE AS 2: CLOSE 2
2110 OPEN "o0d" FOR OUTPUT ACCESS READ SHARED AS 2: CLOSE 2
2120 OPEN "o0e" FOR OUTPUT ACCESS WRITE SHARED AS 2: CLOSE 2
2130 OPEN "o0f" FOR OUTPUT ACCESS READ WRITE SHARED AS #2: CLOSE 2
2210 OPEN "o10" FOR OUTPUT ACCESS READ LOCK READ AS 2: CLOSE 2
2220 OPEN "o11" FOR OUTPUT ACCESS WRITE LOCK READ AS 2: CLOSE 2
2230 OPEN "o12" FOR OUTPUT ACCESS READ WRITE LOCK READ AS #2: CLOSE 2
2240 OPEN "o13" FOR OUTPUT ACCESS READ LOCK WRITE AS 2: CLOSE 2
2250 OPEN "o14" FOR OUTPUT ACCESS WRITE LOCK WRITE AS 2: CLOSE 2
2260 OPEN "o15" FOR OUTPUT ACCESS READ WRITE LOCK WRITE AS #2: CLOSE 2
2270 OPEN "o13" FOR OUTPUT ACCESS READ LOCK READ WRITE AS 2: CLOSE 2
2280 OPEN "o14" FOR OUTPUT ACCESS WRITE LOCK READ WRITE AS 2: CLOSE 2
2290 OPEN "o15" FOR OUTPUT ACCESS READ WRITE LOCK READ WRITE AS #2: CLOSE 2
2300 REM not trying all combinations of this...
2310 OPEN "o16" FOR OUTPUT ACCESS READ WRITE LOCK READ WRITE AS #2 LEN=128: CLOSE 2
2400 REM errors
2430 OPEN "o17" FOR OUTPUT
3000 REM INPUT
3050 OPEN "o03" FOR INPUT AS 2: CLOSE 2
3055 OPEN "o04" FOR INPUT AS #2: CLOSE 2
3060 OPEN "o05" for INPUT AS 2 LEN=128: CLOSE 2
3070 OPEN "o06" for INPUT AS #2 LEN=128: CLOSE 2
3080 OPEN "o07" FOR INPUT ACCESS READ AS 2: CLOSE 2
3082 OPEN "o08" FOR INPUT ACCESS WRITE AS 2: CLOSE 2
3085 OPEN "o09" FOR INPUT ACCESS READ WRITE AS 2: CLOSE 2
3090 OPEN "o0a" for INPUT SHARED AS 2: CLOSE 2
3090 OPEN "o0b" for INPUT LOCK READ AS 2: CLOSE 2
3100 OPEN "o0d" for INPUT LOCK WRITE AS 2: CLOSE 2
3100 OPEN "o0c" for INPUT LOCK READ WRITE AS 2: CLOSE 2
3110 OPEN "o0d" FOR INPUT ACCESS READ SHARED AS 2: CLOSE 2
3120 OPEN "o0e" FOR INPUT ACCESS WRITE SHARED AS 2: CLOSE 2
3130 OPEN "o0f" FOR INPUT ACCESS READ WRITE SHARED AS #2: CLOSE 2
3210 OPEN "o10" FOR INPUT ACCESS READ LOCK READ AS 2: CLOSE 2
3220 OPEN "o11" FOR INPUT ACCESS WRITE LOCK READ AS 2: CLOSE 2
3230 OPEN "o12" FOR INPUT ACCESS READ WRITE LOCK READ AS #2: CLOSE 2
3240 OPEN "o13" FOR INPUT ACCESS READ LOCK WRITE AS 2: CLOSE 2
3250 OPEN "o14" FOR INPUT ACCESS WRITE LOCK WRITE AS 2: CLOSE 2
3260 OPEN "o15" FOR INPUT ACCESS READ WRITE LOCK WRITE AS #2: CLOSE 2
3270 OPEN "o13" FOR INPUT ACCESS READ LOCK READ WRITE AS 2: CLOSE 2
3280 OPEN "o14" FOR INPUT ACCESS WRITE LOCK READ WRITE AS 2: CLOSE 2
3290 OPEN "o15" FOR INPUT ACCESS READ WRITE LOCK READ WRITE AS #2: CLOSE 2
3300 REM not trying all combinations of this...
3310 OPEN "o16" FOR INPUT ACCESS READ WRITE LOCK READ WRITE AS #2 LEN=128: CLOSE 2
3400 REM errors
3430 OPEN "o17" FOR INPUT
4000 REM APPEND
4050 OPEN "o03" FOR APPEND AS 2: CLOSE 2
4055 OPEN "o04" FOR APPEND AS #2: CLOSE 2
4060 OPEN "o05" for APPEND AS 2 LEN=128: CLOSE 2
4070 OPEN "o06" for APPEND AS #2 LEN=128: CLOSE 2
4080 OPEN "o07" FOR APPEND ACCESS READ AS 2: CLOSE 2
4082 OPEN "o08" FOR APPEND ACCESS WRITE AS 2: CLOSE 2
4085 OPEN "o09" FOR APPEND ACCESS READ WRITE AS 2: CLOSE 2
4090 OPEN "o0a" for APPEND SHARED AS 2: CLOSE 2
4090 OPEN "o0b" for APPEND LOCK READ AS 2: CLOSE 2
4100 OPEN "o0d" for APPEND LOCK WRITE AS 2: CLOSE 2
4100 OPEN "o0c" for APPEND LOCK READ WRITE AS 2: CLOSE 2
4110 OPEN "o0d" FOR APPEND ACCESS READ SHARED AS 2: CLOSE 2
4120 OPEN "o0e" FOR APPEND ACCESS WRITE SHARED AS 2: CLOSE 2
4130 OPEN "o0f" FOR APPEND ACCESS READ WRITE SHARED AS #2: CLOSE 2
4210 OPEN "o10" FOR APPEND ACCESS READ LOCK READ AS 2: CLOSE 2
4220 OPEN "o11" FOR APPEND ACCESS WRITE LOCK READ AS 2: CLOSE 2
4230 OPEN "o12" FOR APPEND ACCESS READ WRITE LOCK READ AS #2: CLOSE 2
4240 OPEN "o13" FOR APPEND ACCESS READ LOCK WRITE AS 2: CLOSE 2
4250 OPEN "o14" FOR APPEND ACCESS WRITE LOCK WRITE AS 2: CLOSE 2
4260 OPEN "o15" FOR APPEND ACCESS READ WRITE LOCK WRITE AS #2: CLOSE 2
4270 OPEN "o13" FOR APPEND ACCESS READ LOCK READ WRITE AS 2: CLOSE 2
4280 OPEN "o14" FOR APPEND ACCESS WRITE LOCK READ WRITE AS 2: CLOSE 2
4290 OPEN "o15" FOR APPEND ACCESS READ WRITE LOCK READ WRITE AS #2: CLOSE 2
4300 REM not trying all combinations of this...
4310 OPEN "o16" FOR APPEND ACCESS READ WRITE LOCK READ WRITE AS #2 LEN=128: CLOSE 2
4400 REM errors
4430 OPEN "o17" FOR APPEND
