Set default data file

Command group Flag affected Reversible Execute on client Platform(s)
Data files NO YES NO All

Syntax

Set default data file {list-of-files (F1,F2,..,Fn)}

Description

This command sets the default data file to be the current data file. Normally, file classes are associated with whatever the current data file is, at the time of execution. You use Set current data file to change the identity of the current data file. As the current data file changes, the file classes are associated with the changed current data file.

Set default data file sets the data file, for the specified file class or list of file classes, to be fixed at whatever is the current data file at the time when the command executes. In other words, it creates an association between a list of file classes and the particular data file that was current. For these file classes, the data file becomes fixed (that is, the "default" data file) and does not change whenever the current data file changes. You can break the association with either a new Set default data file or a Floating default data file command.

When you close the default data file for a file, that file reverts to a floating state. This means that the default data file for that file reverts to the current data file and changes when the current data file changes.

Set default data file does not change the flag but is reversible, that is, when the command is reversed, the previous default data files are restored. A runtime error occurs if there are no data files open when the command is executed.

Example

Open data file {myDataFile} ;; open first datafile
Open data file (Do not close other data) {myOtherDataFile} ;; open second datafile
Set default data file {fCustomers,fOrders}
Set current data file {myDataFile}
Set main file {fCustomers}
; This now refers to the myOtherDataFile NOT myDataFile which is the current data file