Format:
b = setfile(ext-dict-name | file-name, alpha-exp
[, update | append | create]);
Description:
The setfile function assigns a new physical file to a dictionary or declared file.
The ext-dict-name or file-name must be supplied. Ext-dict-name is the name of a data dictionary defining an external data file. File-name is the name of a file declared in a file statement.
Alpha-exp is an alphanumeric expression containing the folder and file name of the file to be attached.
The keywords update, append or create are optional. If no keyword is coded, the file is opened in update mode.
When an ext-dict-name is used, if update or append is used, when the file is opened, its contents are not changed, and the file is ready to update cases. If create is coded, when the file is opened, all previous records are removed and the file is ready to add cases.
When a file-name is used, if update is used when the file is opened, you are positioned at the beginning of the file. If append is coded, when the file is opened, its contents are not changed, and you are positioned at the end of the file. If create is coded, when the file is opened, all previous records are removed and you are positioned at the beginning of the file.
In both cases, if create or append is used and the file does not already exist, a new empty file will be created. If update is used and the file does not already exist, the function will fail and return 0.
Return value:
The function returns a logical value of 1 (true) if the new physical file is successfully assigned and 0 (false) otherwise.
Example 1:
OK = setfile(LOOKUP, "c:\My Lookup File.dat");
Example 2:
OK = setfile(REPORT, REPORT_FILE_NAME, create);
See also: File Statement, Filename Function, Setoutput Function