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!
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 -
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
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).
and before anyone gets all excited and decides
to flame or correct me... I meant to type "RSX"
and not "RMS".
[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