See Also: Open, Set_Attribute, Structure_Start, Zerofile
To create a new, empty database table, or to modify the structure of an existing one.
.DEF files are designed to work with the embedded database. We recommend using the native tools of the database you are working with to maintain table definitions.
Make_File {def-root-name} [{path} [{table-number}]] [{driver-name}
Def_root_name The root name (without the .DEF extension, but with drive designator and subfolder path if necessary) of an ASCII source definition file produced by Output_Aux_File.
Path An optional path or drive designator which specifies where the new table is to be created. It must end in the operating system delimiter (e.g., \).
File_number An optional integer which specifies the table number to be used in FILELIST.CFG for the new table (if different from that contained in the .DEF file). This option may be used only if a path is specified.
Driver_name An optional database-driver name. If you wish the created table to be in the format of another database driver, you can specify it through this parameter.
Make_file allows a running DataFlex program to read a file definition from an ASCII source definition (.DEF) file created using Output_Aux_File and create a new, empty database table having the same specifications, or modify an existing table to match the specifications in the .DEF.
Options of make_file permit use of a definition source file on another drive and subfolder, and permit specification of a different filelist number from that contained in the source definition file.
make_file "vanilla" "\dataflex\mydata\" 99
This reads a database table definition from File VANILLA.DEF in the current folder, and creates a database file in folder \dataflex\mydata, assigned to table 99.
If you wish to specify table-number but do not wish to specify path, you may give a pair of quotation marks ("") to hold the place of path.
The new database table created will have the root name specified in def_root_name.def, which need not match def_root_name itself. Files for indexes, column names, and data will be created as required by driver_name, all with the same root name.
If you use the path argument, the .FD file will be created in the current folder; all other files will be created in the folder specified in path.
File_number is the number in the filelist you are assigning to the new table. It may be any value within the supported range. If you don't specify a number, DataFlex will use the file number in def_root_name.
If def_root_name is not found, DataFlex Error 60 (Bad or missing .DEF file) will be reported. If the new database table can't be created, DataFlex Error 72 (Table not open) will be reported.
If path does not end in the delimiter of your operating system for folder and filenames ("\" in DOS), DataFlex Error 75 (Can't open data .DAT file) will be triggered.
When make_file is used on an existing table, it will convert the table to match the .DEF, doing any restructuring necessary.
Caution: Modifying an existing table through this method is an advanced activity; there are few or no safeguards. For example, if you try to use make_file twice on the same table, the results are unpredictable.
Note that any modifications you can do through make_file can also be done in a structure_start/_end block, by setting the column and index attributes (using the Set_Attribute command).
Make_file cannot work on def_root_name files produced under drivers other than DataFlex. With the driver_name argument, however, it will produce tables for use by such other driver.