CLEAR-FILE Command

The CLEAR-FILE command deletes all items from a specified data file or dictionary, while preserving the file’s allocated space. This command has two formats, depending on whether you are clearing the data portion or the dictionary portion of a file.

Format

CLEAR-FILE DATA {filename | dict-name,data-name}

CLEAR-FILE DICT filename

Parameter(s)

DATA

Specifies the data file.

DICT

Specifies the file dictionary.

{filename}

Name of the file.

{dict-name,data-name}

Full name of the file. Use this form to clear a data file that is one of multiple files associated with a single dictionary.

Description

When a file is cleared, the disk space originally allocated for the file is not changed; however, any additional frames linked to the file are returned to the available space table.

You must clear each dictionary and its associated data file with a separate CLEAR-FILE command. D-pointers are not deleted from a file dictionary.

CAUTION

Use this command with care. The system does not display any messages confirming that the file has been cleared. The system does not warn or prevent you from clearing a file.

Clearing a Data File

Assume that a file called DAILY-UPDATES records the changes that users make to various files. At the end of each work day all the changes are processed and therefore do not need to be maintained in DAILY-UPDATES. The CLEAR-FILE command deletes all items in this file, but retains the basic structure of DAILY-UPDATES for reuse each day.

The following example clears DAILY-UPDATES at the end of the day:

>CLEAR-FILE DATA DAILY-UPDATES

The next example clears a data file named PARTS, which is one of several files associated with a dictionary named INVENTORY:

>CLEAR-FILE DATA INVENTORY,PARTS

The next example clears the dictionary of INVENTORY but not the associated D-pointers such as PARTS:

>CLEAR-FILE DICT INVENTORY