60. Opening disc files ~~~~~~~~~~~~~~~~~~ When you open files on a disc for input, using the commands OPENIN or OPENUP, the syntax is basically chan=OPENIN("myfile"). The first file to be opened is allocated a channel number like 1, (ie. the variable 'chan' becomes 1), and if you open another file without closing the first, it is allocated the next channel number, (eg 2), and so on. The numbers don't necessarily start at 1; that's just an example. On most DFSs and ADFS, an interesting thing happens when using OPENIN or OPENUP, where the filename should already exist on disc, but cannot be found, either because you have put the wrong disc in, or maybe because you have mistyped the filename. Instead of causing an error, as you might expect, it simply allocates channel number zero. Thus, you have a very useful way of trapping the mistake before it actually causes an error. Eg. you could add something like: IF chan=0 THEN PRINT "Oops!":GOTO 200 There is no need to use CLOSE#, as the file hasn't been opened in the first place. Only when you attempt to use INPUT#/PRINT#/BGET#/BPUT# on this non-existent file, does the DFS return the error "Channel", (ERR=222).