Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

F$FILE_ATTRIBUTE

5 views
Skip to first unread message

Ed Albert

unread,
Mar 10, 1998, 3:00:00 AM3/10/98
to

Trying to test to see if a file is locked from a COM file, to avoid
conflicts but when I do F$FILEATTRIBUTES(P1,"LOCKED"), where P1 is the
parameter containing the file name I am checking, the system gives me back
a "file access conflict" error when the file is actually in a locked state.
Same result if I hardcode the file name in, so I can never seem to get to
the "TRUE" stage.

I am testing using a COBOL program in another session that opens a file
using the ALLOWING NO OTHERS phrase to make sure the file is locked.
Ed

Out the 10-Base-T, through the router, down the T-1,
over the leased line, off the bridge, past the firewall... nothin' but net!

Mark D. Jilson

unread,
Mar 10, 1998, 3:00:00 AM3/10/98
to

Sorry but LOCKED in this case doesn't mean what you think it means. From HELP
LEX F$FILE
LOCKED String TRUE if a file is deaccessed-locked;
otherwise FALSE

In this case deaccessed-locked is related to the way RSX applications would
handle a file.

Ed Albert wrote:

--
Jilly - Working from Home in the Chemung River Valley - Waverly, NY
- ji...@clarityconnect.com - Brett Bodine fan
- m_ji...@csc32.enet.dec.com - since 1975 or so
- http://www.clarityconnect.com/webpages2/jilly -

Veli Körkkö

unread,
Mar 10, 1998, 3:00:00 AM3/10/98
to


Ed Albert wrote:

> Trying to test to see if a file is locked from a COM file, to avoid
> conflicts but when I do F$FILEATTRIBUTES(P1,"LOCKED"), where P1 is the
> parameter containing the file name I am checking, the system gives me back
> a "file access conflict" error when the file is actually in a locked state.
> Same result if I hardcode the file name in, so I can never seem to get to
> the "TRUE" stage.
>
> I am testing using a COBOL program in another session that opens a file
> using the ALLOWING NO OTHERS phrase to make sure the file is locked.
> Ed
>
> Out the 10-Base-T, through the router, down the T-1,
> over the leased line, off the bridge, past the firewall... nothin' but net!

You are not going to reach your target with f$file(file,"LOCKED"). Help says


LOCKED String TRUE if a file is deaccessed-locked;
otherwise FALSE

Seems that LOCKED is sort of special state that sometimes files are left. See
SET FILE/UNLOCK
for


SET

FILE

/UNLOCK

Makes one or more improperly closed files accessible.

I'd imagine that you really should try to open the file, e.q.

$ open/read/write test file.dat
$ if .not. $status
$ then
$ write sys$output "Was locked by someone else"
$ else
$ close test
$ write sys$output "Was not locked"
$ endif

Downside here is that the file is actually opened (if it was not in use...)
hence file dates
get changed.

_veli


norm lastovica

unread,
Mar 10, 1998, 3:00:00 AM3/10/98
to Ed Albert

In HELP, the description of the LOCKED item
reads "TRUE if a file is deaccessed-locked".
This type of locking is rarely (if ever) used
in VMS (it is/was an RMS thing) and has no
meaning in regards to files being locked.

You might want to try to open the file in DCL
with the "/share" qualifier to see if it was
opened by another allowing sharing (the open
ought to fail if the other process didn't allow
sharing).

norm lastovica

unread,
Mar 10, 1998, 3:00:00 AM3/10/98
to

norm lastovica wrote:

> In HELP, the description of the LOCKED item
> reads "TRUE if a file is deaccessed-locked".
> This type of locking is rarely (if ever) used
> in VMS (it is/was an RMS thing) and has no
> meaning in regards to files being locked.

and before anyone gets all excited and decides
to flame or correct me... I meant to type "RSX"
and not "RMS".

Gotfryd Smolik

unread,
Mar 11, 1998, 3:00:00 AM3/11/98
to

On Tue, 10 Mar 1998, Veli K=F6rkk=F6 wrote:

[some cuts, description about LOCKED also]
+Ed Albert wrote:
+
+> Trying to test to see if a file is locked from a COM file,
[cut]
+> I am testing using a COBOL program in another session that opens a file
+> using the ALLOWING NO OTHERS phrase to make sure the file is locked.
^^^^^^^^^^^^^^^^^^
******************
[cut]
+I'd imagine that you really should try to open the file, e.q.
+
+ $ open/read/write test file.dat
+ $ if .not. $status
[cut]
+Downside here is that the file is actually opened (if it was not in use...=
)
+hence file dates get changed.

What I am can say:
1. Ed will check if the file is properly OPEN/NOSHARE then
simple OPEN/READ is anought: it must be also rejected !
2. It's test only, then your example is enought -:)
3. If the "diagnostic process" may run with another
UIC the protection may be set to disallowing access
to the file (ugh... here the date are modified...).
At the access time sharing is checked *before*
protection and you get "currently locked" when
locked and "not privilege" when not locked -:)
Probably unsupported...

Regards - Gotfryd

--
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
$ ON F$ERROR("LANGUAGE","ENGLISH","IN_MESSAGE").GT.F$ERROR("NORMAL") -
=09=09THEN EXCUSE/OBJECT=3DME
$! G...@stanpol.zabrze.pl
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D


0 new messages