[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

Detecting open RMS files?

» close window

The Question is:

 
I am moving a COBOL program with lib$ routines from 5.5 to 7.1.
 
It is a "print utility program" that uses the LIB$FIND_FILE routine to
display files that can be printed in a user directory.
 
In 5.5 it would NOT display a file in use (in the process of being writen
to).  In 7.1 it
display the file when it is in use, and when the user tries to print it is
errors because it is in use.
 
How can I get only files that ARE NOT IN USE to display using the LIB$
routines.
 
I use the following:
 
010310   PERFORM UNTIL FF-STATUS IS FAILURE
010320   CALL "LIB$FIND_FILE" USING
010330    BY DESCRIPTOR FF-FILE-SPEC,
010340    BY DESCRIPTOR FF-RESULT-SPEC,
010350    BY REFERENCE FF-CONTEXT
010360     GIVING FF-STATUS
 
Thank you for help.
 
Tara Rettig
 


The Answer is :

 
  Most files that are "in use" -- locked by other accessors -- have always
  been visible to various directory-level operations.  One obvious exception
  to this includes files that are not presently in a directory.
 
  Obvious approaches include not placing temporary (open) files in the
  directory until ready (RENAME or otherwise), performing an open of the
  file and trapping the error (effective, but very slow), opening the files
  in the directory with the SHARE option (permitting access to the files),
  opening the files as temporary and/or not in the directory, and simply
  reporting the error back to the user.  (Even with one of the various
  alternatives, reporting the error will typically be necessary in any
  event, in the unlikely case that the file is locked by another user.)
 
  The sharing of RMS file access on the OPEN is in the OpenVMS FAQ, in the
  section entitled "How can I open a file for shared access?".

answer written or last revised on ( 15-NOV-1999 )

» close window