Operating System - OpenVMS
Showing results for 
Search instead for 
Did you mean: 

f$file_attributes failure

Go to solution
Shael Richmond
Frequent Advisor

f$file_attributes failure

Is there a way around this? A directory command works but is harder to parse.

$! Get the creation date and size.
$ filetime = f$file_attributes(filename, "CDT")
%SYSTEM-W-ACCONFLICT, file access conflict
$ filesize = f$file_attributes(filename, "EOF")
%SYSTEM-W-ACCONFLICT, file access conflict
$ if filesize .le. 0 then goto file_loop
Hein van den Heuvel
Honored Contributor

Re: f$file_attributes failure

Yeah, F$FILE uses SYS$OPEN and thus requires sharing access, as it allows data access.

DIRECTORY (/FULL) uses ACP QIOS just for the attributes.

I consider it a DCL bug to have implemented it this way, but what are we to do?
It should also allow for a list of attributes IMHO, to avoid excessive work, but again that's not how it is.

So for myself I wrote a little C program (attached!) to mimiv F$FILE, but use an ACP QIO to get attributes. Of course is is not integrated as nicely as F$FILE, and is involves an image activation, but it has helped me out!

Code attached, and sample usage below.


$ mcr sys$login:f$file sys$login:login.com
Usage: $ mcr f$file "[PRINT,]CDT, EOF, ..." [comment]
Defines F_FILE
$ mcr sys$login:f$file sys$login:login.com ebk,ffb,org
F$FILE -- unsupported attribute requested. Returning
$ mcr sys$login:f$file sys$login:login.com eof,ffb,org
$ show sym *file*
F_FILE = "4|280|SEQ"
$ mcr sys$login:f$file sys$login:login.com print,rat,rfm
Hein van den Heuvel
Honored Contributor

Re: f$file_attributes failure

Btw... if this happens a lot, then you may want to protect your F$FILE with an OPEN first

$OPEN/error=probably_locked/SHARE=WRITE file 'filename
$filetime = f$file_attributes(filename, "CDT")
$CLOSE file
$ status = $STATUS
$ IF status .EQ. %x0800
$ THEN...