Is that really all of your code? Did you
use Fcntl; as alluded to by the docs for
sysopen? If you don't load the proper constants, the O_CREAT flag does you no good, and you can't open the nonexistent file. This would be the expected behavior for trying to open a non-existent file without the O_CREAT flag.