FILEPATH Function

Returns the path of the file referenced by a file variable.

Syntax

FILEPATH({fileVar})

Syntax Elements

fileVar The name of a variable containing a file reference (assigned via an OPEN statement). If fileVar is not specified, the internal default file variable is used; that is, the file used is that most recently opened without a file variable.

Return Value

FILEPATH returns a dynamic array containing the following:

Attribute 1 An integer representing the file level. One of the following:

0 SYSTEM.

1 Account master dictionary.

2 File dictionary.

3 File data section.

Attribute 2 The name of the account.

Attribute 3 The name of the file. Only included for levels 2 and 3.

Attribute 4 The name of the data section. Only included for level 3.

If fileVar is not a file variable, FILEPATH returns null.

Comments

If fileVar references a synonym item (Q- or R-pointer) the path to the actual file is returned.

Examples

The following table lists return values for the SYSMAN account:

  Return value
File-specifier 1 (level) 2 (account) 3 (file) 4 (data)
SYSTEM 0 SYSTEM
/SYSTEM/ 0 SYSTEM
/SYSPROG/ 1 SYSPROG
MD 1 SYSMAN
DICT BP 2 SYSMAN BP
/SYSPROG/BP 3 SYSPROG BP BP
SYSPROG,BP, 3 SYSPROG BP BP
BP 3 SYSMAN BP BP
BP,BP 3 SYSMAN BP BP
BBP (Q-pointer to BP) 3 SYSMAN BP BP

See Also

FILEINFO function.

Go to top button