HP OpenVMS Systems

ask the wizard
Content starts here

RMS File Locking (FLK) Errors?

» close window

The Question is:

I cant open a file with EDIT/EDT while another program is writing to it.
I have read the Q&A on 6828 and 2867
and used the C-program to test if its my program that is doing something wrong
 but I get the same result with the testprogram:
>>ed tmp.tmp
%EDT-F-OPENIN, error opening MAS:[LD_UTV.CY]TMP.TMP; as input
-RMS-E-FLK, file currently locked by another user
>>ed tmp.tmp/read
%EDT-F-OPENIN, error opening MAS:[LD_UTV.CY]TMP.TMP; as input
-RMS-E-FLK, file currently locked by another user
with the example program, am I missing something simple or is EDIT/EDT?
It works fine with TYPE:
>>type tmp.tmp
Iteration count: 0
Iteration count: 1
Iteration count: 2
Why not just use TYPE? well my users are using EDIT/EDT to access all other
 information files in the "system".

The Answer is :

  The OpenVMS Wizard strongly encourages you to acquire and read the
  available User's Manual and the Programming Concepts documentation
  as a start, and to particularly to understand the intent and the
  general implementation of the file-locking mechanisms within OpenVMS.
  The RMS file locks involved here are explicitly intended to avoid
  cases where an application will receive inconsistent data; to prevent
  access to file information when the application is not coded to permit
  such shared access -- the means used to enable such shared access is
  what is discussed in the OpenVMS FAQ and in Ask The Wizard topics such
  as (6828) and (2867).
  Users that blindly use EDIT/EDT or another text editor for all file
  display operations are exceedingly hazardous to the continued operation
  of OpenVMS and of the application involved, as an unintended save or
  write command from within a text editor can easily alter the file
  format and can obviously also alter the file contents.  Depending on
  the particular target file(s) overwritten, this activity can cause
  OpenVMS and/or application failures.
  Related discussions include (2467), (3320), (6326), (7779)
 FLK,  file currently locked by another user
  Facility:     RMS, OpenVMS Record Management Services
  Explanation:  An attempt to open or create a file failed. Another user
                has the file open in a mode incompatible with the attempted
  User Action:  Wait until the other user has deaccessed the file. If the file
                is to be shared, verify that the SHR option is selected in the
                FAB for all users that need to access the file. If the file
                cannot be shared, modify the program to detect and respond to
                the condition by waiting.

answer written or last revised on ( 24-NOV-2003 )

» close window