[fa.info-vax] File-Exist ?

info-vax (07/07/82)

>From Fathi.ES@PARC-MAXC Wed Jul  7 15:36:45 1982
	Dear VAX/VMS  user,

	Is there any built-in function to check if the specified file exist or not?

	For example;

	IF (.NOT.FILEEXIST(Filename)) CALL ERROR

Thanks,

Nader

info-vax (07/08/82)

>From kooy.Henr@PARC-MAXC Thu Jul  8 05:35:43 1982
Dear Fathi,

I would just open the file with an error condition, like
	OPEN (UNIT=LUNFIL, FILE=FILNAM, STATUS='OLD',ERR=NNN)
	GOTO LLL
NNN	CALL ERROR
LLL	CONTINUE

Hanne Kooy

info-vax (07/08/82)

>From grubin@BBN-UNIX Thu Jul  8 07:17:13 1982
Assuming your question about file existence is asking about DCL level
functions:
Currently there is no function to check if a file exists. There are
various ways around this - using OPEN with the /ERROR  switch and
checking in the error  handler for the error code which is
file-not-found. COMING IN VMS 3.0 there IS a logical function
called F$SEARCH which CAN be used to check for file existence - so
if you can wait til your site puts up version 3.0 you will have what
you need.

>From a program, I guess you would use the RMS function SEARCH.

-- Gail Rubin, BBN

info-vax (07/08/82)

>From buck@NRL-CSS Thu Jul  8 11:13:05 1982
The INQUIRE statement will do the job. The statement
 
	INQUIRE(FILE=filename,EXIST=ex)
 
where filename is a character variable or string, and ex is a logical
variable, will set ex true if the file exists and false if not. Note
that INQUIRE is a statement, not a function (like OPEN). See section
9.3 of the VAX-11 FORTRAN manual (April 1980) for more details.