Clear
See Also: Understanding File Buffers and DDO Field Buffers, Constrained_Clear, Find, Save, Saverecord
Purpose
To erase all data from the record buffers of one or more database tables. The status of the tables is set to inactive. The DataDictionary class provides superior functionality that replaces the need for this command.
Syntax
Clear {DF_ALL | table} […] {table}
Where {table} is the name or filelist number of one or more database tables. The table must be open.
What It Does
Clear deactivates the record buffer for {table}, sets all string fields to blanks, all numeric and date fields to zero, and the record number to zero.
The DF_ALL parameter clears all record buffers of all open tables.
Example
Clear vendor customer employee
This clears the record buffer for the vendor, customer, and employee database tables. Assuming these tables are number 1, 4, and 6 in the table list, the following command would be equivalent:
Clear 1 4 6
Notes
-
Use the
Clearcommand any time you want a freshly initialized record buffer, such as just before you enter data for a new record, or on which to execute a find command. -
To save a copy of the active record, only distinguished by the record number, set the table status inactive by using the following command:
Move 0 To df_table.recnum -
The record buffer must not be cleared after changes have been made to an existing record in the record buffer or those changes will be lost. Use the Save command or Saverecord command to save changes to your database tables.
-
A Find
GTorGEcommand on a cleared record buffer will find the first record in the table. AFind LTorLEcommand will find the last record in the table.