Operating System - OpenVMS
1827708 Members
2883 Online
109967 Solutions
New Discussion

f$file_attributes failure

 
SOLVED
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
\PPR$DISK:[PPR.PPR_COMMON.HISTORY]TI_HIST_REPORT.201104221329;1\
$ filesize = f$file_attributes(filename, "EOF")
%SYSTEM-W-ACCONFLICT, file access conflict
\PPR$DISK:[PPR.PPR_COMMON.HISTORY]TI_HIST_REPORT.201104221329;1\
$ if filesize .le. 0 then goto file_loop
2 REPLIES 2
Hein van den Heuvel
Honored Contributor
Solution

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.
Enjoy!

Hein


$ 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
CR|VAR
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
:
$probably_locked:
$ status = $STATUS
$ IF status .EQ. %x0800
$ THEN...
:

fwiw,

Hein.