Set_filelist Command
Obsolete
The set_filelist command is obsolete. Use the DF_FILELIST_NAME Database API attribute in its place.
This command was often used when filelists could only contain fewer tables than now or to add functionality that is now achieved by using multiple workspaces with different data paths.
Purpose
To identify the path and filename of the file to be used as the file list.
Syntax
set_filelist
file_name
Argument Explanation
- file_name: The pathname of the file to set as the file list.
What It Does
This command sets the file list to be used by DataFlex until it is reset, either by another set_filelist command or when the program ends. This allows you to easily switch between groups of files and file lists within a running program.
file_name must be a valid file list. The DataFlex compiler does not check this name to ensure that it is actually a file list. If file_name is not a file list, then the program will terminate abnormally.
set_filelist "c:\test\filelist.cfg"
This example sets the file list to FILELIST.CFG in the C:\TEST directory.
Notes
-
Be aware that if you change file lists within a running program, DataFlex no longer automatically protects against deadlock. DataFlex opens and locks files in order of their file-list numbers. By changing file lists, it becomes possible for deadlock to occur, so you must consider how to handle possible deadlock. The same thing is true when using the
Open ... ascommand. -
You cannot have two files open under the same number at the same time. For example, assume you are using these two file lists:
FILELIST.CFG FL2.CFG
: :
4. Employee 4. TestData
5. OrdEntry 5. TestRslt
6. Details 6. TestSpec
: :
Now the following code executes while FILELIST.CFG is the file list:
open OrdEntry
set_filelist "FL2.CFG"
:
open TestRslt
The open TestRslt statement will fail, since DataFlex sees that File Number 5 is already open. No error will be reported, since DataFlex has no way of knowing that you are trying to open a different File Number 5 from the one already open.
- It is recommended that a given file have the same number in every file list in which it appears. This can avoid many problems, such as the one described above.