Skip to main content

This is documentation for Caché & Ensemble.

For information on converting to InterSystems IRIS, see the InterSystems IRIS Adoption Guide and the InterSystems IRIS In-Place Conversion Guide, both available on the WRC Distributions page (login required).

Previous sectionNext section


Returns information about an open file.




filevar An expression that resolves to a file variable name used to refer to the file in Caché MVBasic.
key An expression that resolves to an integer code used to specify what file information to return. Available values are 0 through 3.


The FILEINFO function returns various types of information about an open file. You must specify a filevar supplied by an open statement, such as OPEN or OPENSEQ. You can use FILEINFO(filevar,0) to determine if filevar is valid. If filevar is not valid and key is 1 through 3 (inclusive), FILEINFO returns the empty string.

The following are the available key options and return values:

0 File variable: 1 if filevar is valid. Otherwise 0.
1 VOC name: The VOC name of a MultiValue file. For example, myfile. If filevar does not refer to a MultiValue file, returns a null string.
2 Pathname or global name: For a MultiValue file, the name of a Caché global variable. For example, ^|"USER"|myfile. For a sequential file, the fully-qualified pathname of the file, as specified in the OPENSEQ statement. If the file does not exist, this is returned as a directory path.
3 File storage type: 0=unknown. 1=top level global (static hashed file) the default for MultiValue data files. 2=subscripted global subnode. 4=directory. 5=sequential file.

Other MultiValue implementations may support higher key option values; these are not supported by Caché MVBasic.


The following example opens a sequential file, tests the file variable, then uses the file variable to return the file's pathname and the file type (in this case, type 5):

OPENSEQ "C:\temp\file1" TO myfile
IF FILEINFO(myfile,0)=1
   THEN PRINT "valid file variable"
   ELSE PRINT "file variable not valid"
PRINT "File pathname is:",FILEINFO(myfile,2)
PRINT "File type is:",FILEINFO(myfile,3)
Copy code to clipboard

See Also

FeedbackOpens in a new window