When you want to open a file within an SBX that has nothing to do with the calling program, one concern is how to select a file channel that is guaranteed not to be in use already. The best way to do this is to start with a suitably high file channel (one not likely to be used by the calling programs), and then just to be safe, use the EOF() function to verify that the channel is free, incrementing the channel if necessary until a free one is found. For example:
FCH = 50000 ! start with a high file channel
do while eof(FCH) = 0 ! keep looking until we find a free channel
FCH = FCH + 1
loop
open #FCH, FSPEC, output
...