In Business Basic, if you open TWO random access files and then try to access
some of the records, you get a SOS CALL ERROR 22. This error occurs, for
example, in line 511 of the following sample program:
Enter the record number 723 for A%, and anything for B%;
enter anything for A$ and B$ on the first entry;
enter the record number 723 for A%, and anything for B%;
the system crashes with a "SOS CALL ERROR 22".
10 OPEN#6,".PROFILE/FILE1",15
20 OPEN#7,".PROFILE/FILE2",15
25 CATALOG".PROFILE"
30 INPUT "Enter A% ";A%
40 INPUT "Enter B% ";B%
50 ON EOF#6 GOTO 500
60 READ#6,A%
70 R=0:IF TYP(6)<>4 THEN GOTO 510
80 READ#6;A$
90 IF R=0 THEN 520
95 INPUT "Enter A$ & B$";A$,B$
100 WRITE#7,B%;A$
110 WRITE#6,A%;B$
120 GOTO 25
500 PRINT"Nothing in the file":OFF EOF#6:GOTO 70
510 PRINT"Nothing in the record":R=1
511 CLOSE#6
512 OPEN#6,".PROFILE/FILE1",15
513 GOTO 90
520 END
If, however, you add the following lines, the program seems to continue to work
normally:
5 ON ERR GOTO 1000
1000 PRINT"Error# "; ERR
1010 OFF ERR
1020 GOTO 512
Use this workaround to avoid any further problems.