b = setfile(dictionary_name ‖ file_handler, file_nameʃ, update ‖ append ‖ createʅ);
The
setfile function assigns a data file to the dictionary associated with
dictionary_name or associates the
File file_handler to a text file on the disk. The
file_name argument is a string expression containing the file name of the file to be associated with the dictionary or file. With dictionaries, the
file_name can also be a
connection string.
Using the keyword update, append or create is optional. If no keyword is used, the file is opened in update mode.
Dictionary behavior: If update or append is used, the data file's contents are not changed and the file is ready to update cases. If create is used, all previous cases are removed and the file is ready to add cases.
File behavior: If update is used, you are positioned at the beginning of the file. If append is used, the file's contents are not changed and you are positioned at the end of the file. If create is used, all previous content in the file is removed and you are positioned at the beginning of the file.
For both dictionaries and files, 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.
The function returns a logical value of 1 (true) if the new file is successfully assigned and 0 (false) otherwise.
File household_report_file;
setfile(household_report_file, "Household Report.txt", create);