- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 07:41 AM
01-17-2006 07:41 AM
In my testing, if the file is "locked" (I have it OPEN/APPEND in another session), the symbol assignment blows up:
$ FILE_TO_SEND = F$SEARCH("sys$sysdevice:[mydir.temp]*.*;*",1)
$ FLOCK = F$FILE_ATTRIBUTES(FILE_TO_SEND,"LOCKED")
%SYSTEM-W-ACCONFLICT, file access conflict
\SYS$SYSDEVICE:[MYDIR.TEMP]JAN17_A.TXT;1\
$ show sym flock
%DCL-W-UNDSYM, undefined symbol - check validity and spelling
$ IF FLOCK THEN GOTO LOCKED_EXIT
%DCL-W-UNDSYM, undefined symbol - check validity and spelling
\FLOCK\
If I do this without the file being accessed, it's fine and the symbol FLOCK is "FALSE".
I imagine there's a different way to do this?
Cheers,
Art
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 08:55 AM
01-17-2006 08:55 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
I am about to run for a meeting, but you should be able to perform the needed experiment.
Having dealt with the lock bit since the days of RSX-11D, I will theorize that the lexical you need to check the underlying RMS manual for the exact meaning of the lock bit.
I will try to get a chance to take a look later.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 09:04 AM
01-17-2006 09:04 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
Anyway, this will most likely do what you require; as would F$FILE using most any argument.
$ FILE_TO_SEND = F$SEARCH("sys$sysdevice:[mydir.temp]*.*;*",1)
$ SEVERITY = F$ENVI("ON_SEVERITY")
$ ON WARNING THEN GOTO LOCKED_EXIT
$ FLOCK = F$FILE_ATTRIBUTES(FILE_TO_SEND,"LOCKED")
$ ON 'SEVERITY' THEN EXIT
You can surround the lexical invocation with redefiniton of SYS$ERROR and SYS$OUTPUT to the NL device if you want to suppress the error messages that result from the file access conflict.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 09:11 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 09:13 AM
01-17-2006 09:13 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
Maybe I should explain what I'm trying to solve ... it's a "typical" drop box kind of setup. What I've seen in the past is that the during the act of a file being written to the drop directory, my procedure looks in every few minutes and "finds" the file. If the remote process is not finished writing it, I can't work with it (RMS-E-FLK). I handle it, but after the fact. I want to try and make sure that it's available before I carry on hence the desire to see if it's "locked" first.
Cheers,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 09:18 AM
01-17-2006 09:18 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
-- Rob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 09:23 AM
01-17-2006 09:23 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 09:52 AM
01-17-2006 09:52 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
could you able to change your open/append command with
$OPEN/APPEND/SHARE
Archunan
Archie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 01:56 PM
01-17-2006 01:56 PM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
The real drop into the folder is a Decnet copy, I need to rename the file in preparation for FTP'ing to a 3rd party.
I need to know I have exclusive access to the file before I continue. I think the attempting to open it as my status test sounds reasonable.
Will let you know.
Cheers,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 05:55 PM
01-17-2006 05:55 PM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 08:01 PM
01-17-2006 08:01 PM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
For a similar question (copy a file after his generation) I use this command file to test error if file is opened:
$set noon
$fil=f$search("*fic*")
$do:
$!Check if file is locked or opened
$att=f$file_attributes("''fil'","eof")
$if $status .eqs. "%X00000800" !File open
$then
$ wait 00:03
$ goto do
$endif
Saludos.
Daniel.
$exit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2006 10:26 PM
01-17-2006 10:26 PM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
Ok, I am not in such a hurry at this instant.
The LOCKED bit would be on in RSX if the file was not "properly closed". Under RSX, file processing (FCS or RMS) ran in user mode (in RSX-11M-PLUS, RMS could be implemented as a Supervisor mode library, but that is not the same as the RMS implementation in OpenVMS, when an RSX image aborted, the file status was not cleaned up in any way).
This was also the behavior when the system crashed while the file was open for modification. File closing is done differently, but since I lack a machine that I can crash at my pleasure at this instant, I cannot confirm, but strongly suspect that if I have a file open at the time of a crash, I will get a similar status.
The actual file locking (on both RSX and Open VMS) is done via a totally different mechanism, RSX had no mechanism for managing cross system sharing, OpenVMS has the cluster wide locking managed by the Lock Manager.
The best way to check if a file is complete in your case is to check if you can open it for exclusive write. If the open fails, the file is not yet complete. If my memory about the LOCKED state is correct, you also need that check to guard against a file that was left in an incomplete state (and maybe some other consistency checks to guard against files where the incomming network copy was not successful).
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2006 12:57 AM
01-18-2006 12:57 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
Daniel: Thanks. I'll try and rig up a test to see if that's any "better" than trying the OPEN/WRITE test.
Bob: Thanks as well. I remember even less of RSX than I do of VMS ;-)
Cheers,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 07:04 AM
01-31-2006 07:04 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
LINE CODE --DIAGNOSTIC MESSAGE--
196 UPQ unpaired quotation marks (")
The line in question is from part of the routine that WRITEs a temporary comand procedure that will do the actual FTP. I know 100% that it works, but I'm wondering if it really is a syntax problem and if so, what's the proper way.
The line is:
$ WRITE FTPCOM "$ FTP OPEN ''FTP_SITE' ''FTP_USER' ""''FTP_PASS'""
The password that was assigned by the third party vendor is case-sensitive so I need to double quote it. This line wasn't changed and has been called several thousand times in the past two years without fail.
Is it ""wrong"?
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 07:07 AM
01-31-2006 07:07 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
isn't the last " mising (to close the textstring to WRITE)?
regards Kalle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 07:38 AM
01-31-2006 07:38 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
"$ FTP OPEN ''FTP_SITE' ''FTP_USER' ""''FTP_PASS'""
FTP_SITE has two singles before and one single after
FTP_USER same
FTP_PASS has two double quotes, two single quotes before it and one single quote and two double quotes after it.
Basically one set of double quotes surrounding what I want to WRITE and FTP_PASS escaped with with double quotes to get it into what I want to WRITE.
I'll try an attachment and see if that's better.
Cheers,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 07:52 AM
01-31-2006 07:52 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
This doesn't make any problemin DCL, because DCL just terminates the textstring when then line ends, but to be very correct...
regards Kalle
P.S. I attached my version...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 08:59 AM
01-31-2006 08:59 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
Just like you need two singles before and one single after for symbol substitution, I think it would be two doubles before and one double after to make one set of doubles appear in the overall double quoted string.
If we take symbols out of the equation for a moment and say we wanted to have a double quoted word inside the line would we not do this:
(only double quotes in the following)
$ WRITE temp "This is a ""quoted" word"
Is that not standard escaping practice?
Cheers,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 11:25 AM
01-31-2006 11:25 AM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
To make a double-quote appear in a quoted text, you need to double-up on those double quotes.
You have that correct before the word, but incorrect after.
WRITE temp "This is a ""quoted"" word"
but you probably already realized that...
Btw, the := assignment adds more fun:
$ x:=This is a "quoted" word
$ show symb x
X = "THIS IS A quoted WORD"
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2006 12:44 PM
01-31-2006 12:44 PM
Re: Lexical F$FILE_ATTRIBUTES(filename,"LOCKED") usage
I can only give you 9 points though because I'm not happy it doesn't work the way I think it should. ;-) Kalle, reply once more and I'll ""top you up"".
Into production we go ...
Cheers,
Art