The Question is:
What can cause the BASIC error message 162
"Cannot open file" ?
The Answer is :
Print RMSSTATUS and VMSSTATUS as a first attempt toward determining
the particular cause. For example, there might be insufficient
GBLPAGES configured for the required RMS global buffers, and this
can be reflected in the contents of the status variables.
If you know the file existsthere, and can readily open it with DCL
using the same logical names and sharing options, then perhaps
something else caused the BASIC file access to fail. For instance,
a mismatch in the file organization, number of keys, and the record
attributes can cause the access to fail.
The OpenVMS Wizard prefers to create files via FDL, using CREATE/FDL
at DCL or the FDL programming interface (fdl$create) within the
application program, as this provides better control and far easier
tailoring of the file settings. Once the file is created, the BASIC
(or other language) application opens the existing file (eg: OPEN FOR
INPUT (ACCESS MODIFY..), and processes it accordingly. In creating
the file, you can omit all of the the key information, as well as the
initial size and extend size, and can even add keys to the file without
having to modify the application.
The (unsupported, undocumented, CMKRNL or CMEXEC privilege required)
too SET WATCH FILE /CLASS=ALL (or MAJOR) can also be used to gain
insight into where the failure is arising. Use /CLASS=NONE to disable
the output. (See topics 1843 and 2536 for more SET WATCH information.)
For particularly insidious problems, you can also consider using the
USER_OPEN routine, such that you can easily single step the lower level
SYS$OPEN call, analyze its parameters as provided.
For security-related access failures, you can use the OpenVMS security
alarms as a debugging tool, as the messages generated by these failures
(or successes, depending on what alarms and ACEs have been set up) can
help pinpoint the cause of the particular error.