Clearing a File

The CLEAR-FILE processor clears data from a file. It is used if you want to discard the contents of a file yet maintain the primary file space for future use. The CLEAR-FILE processor sets the file to an empty state by placing two segment marks in the first two data positions of each group. Any additional frames that have been linked to a group are released. These frames are returned to the overflow area. Thus, by clearing a file, you reduce it to the space originally allocated for it.

The CLEAR-FILE command clears either the dictionary or the data file. You cannot clear both files with a single command.

Format

CLEAR-FILE [DICT|DATA][dict-name ,]filename

If the dictionary and the data file do not have the same file name, then you must specify the name of the dictionary. If multiple data files are associated with the same dictionary, only the specified data file will be cleared. If the DICT modifier is specified, CLEAR-FILE will clear all items except D-pointers and Q-pointers. Thus, the File Definition items pointing to data files are maintained.

The next example clears all items from the data file SHIPPING.

>CLEAR-FILE DATA SHIPPING

This command does not return a message when successful.

See Also

Overview of File Management Commands

File Name Syntax

Item Lists

Creating Files

Creating mvBASIC Files

Copying a File

Deleting Files

Copying File Items

Editing Items

Deleting Items