Introduction to File and File Index Management

Reality file types

Reality supports the following types of file:

Creating a file

The following commands enable you to create files on your database:

CREATE-FILE

Creates a normal or Foreign Database file.

DIR-VIEW

Creates a file that provides a view of a directory in the host system (UNIX or Windows, as appropriate) from within Reality.

SQL-VIEW

Creates a file that provides a view of an SQL table or SQL view from within Reality.

HYPER-CREATE

Creates a hyper file.

Deleting files and items

The following commands allow you to remove files and items from your database:

CLEAR-FILE

Deletes all items, except data descriptors, from a specified file.

DELETE and EDELETE

Delete selected items from specified file. EDELETE is an English command.

DELETE-FILE

Deletes a specified file, directory view, SQL view or hyper file from the current account.

HYPER-REMOVE

Removes a specific section, or all sections, from a hyper file by updating the lookup table in the hyper file definition item (H-pointer) and, optionally, deletes the sections themselves.

Copying an item

The following commands allow you to copy selected items from a file to another file, terminal or printer:

COPY

Copies selected items from a file to another file, terminal or printer.

CP

Copies selected items from a file to a printer.

CT

Copies selected items from a file to a terminal's screen.

I-DUMP and S-DUMP

Dumps contents of selected items to terminal screen or to printer, displaying system delimiters. These are English commands.

Reformatting data

The commands REFORMAT and SREFORMAT can be used to select and re-order attributes of selected file items and write them to a new file. These are English commands.

Searching for an item-id

The FIND command allows you to search all files in your current account for a specified item-id.

Searching for a string

The SEARCH and ESEARCH commands allow you to search for a specified string within a particular file. ESEARCH is an English command.

Listing files in an account

A number of different commands allow you to list files in your current account according to particular selection criteria and display them on your screen:

LISTDFILES

Lists all dictionaries in the current account.

LISTFILES

Lists all dictionaries and data sections in an account or specified dictionary.

LISTQFILES

Displays all Q-pointers in an account MD.

LISTF2, LISTF3, LISTF4

Display all files in the current account in two-, three- or four-column format.

Listing and sorting items in a file

The following commands allow you to display on your terminal a list of item-ids in a specified file:

LIST4

Lists the item-ids of all items in a specified file in four-column format.

SORT2, SORT3, SORT4

Sort all item-ids in a specified file in ASCII character order and list them in two-, three- or four-column format.

Refer to the English Reference for ways of reporting the contents of a file in more detail.

Moving and renaming files

These commands are provided to move and/or rename files:

MOVE-FILE

Moves a file from one account to another, or a data section from one file to another, and optionally renames the moved file/data section. Also used to rename an account.

MOVE

Moves items from one file/data section to another file or to another data section of the same file, while preserving their time-stamps.

RENAME-FILE

Renames an entire file or a file data section.

File hashing statistics

The following commands display file hashing statistics and optionally a histogram:

HASH-TEST

Displays the distribution of items that would result from a different modulo.

ISTAT

Displays information about the current distribution of items in the file.

SHOW-MODULI

Displays a series of prime numbers that can be used as modulos, from one to greater than 16 million. Each prime number differs from the previous one by at least 10%.

Comparing items

The COMP and COMPARE commands allow you to perform a comparison between items in the same file, or in two different files, and generate a report.

Managing indexes

The following commands are used to manage file indexes:

DEFINE-INDEX

Creates a index definition item in the file dictionary which contains the selection and sort criteria used to create an index. The definition item-id is the index name. It can also be used to recover a deleted or corrupt index definition from an existing index.

CREATE-INDEX

Creates an index section for a particular data section, based on a specified index definition item.

DELETE-INDEX

Deletes an index section previously generated by CREATE-INDEX.

SELECT-INDEX

Generates an active list of selected item-ids in an index, sorted in ascending sequence. The list can then be used by an immediately following English or TCL-II command, including SAVE-LIST.

VERIFY-INDEX

Checks an index against its data section for non-existent item references, or key values that do not match the index sort criteria. Errors must be corrected by deleting the index section using DELETE-INDEX and recreating it using CREATE-INDEX.

LIST-INDEXES

Lists the indexes for a particular file, data section or account. The indexes are verified and any errors reported.

Optimising file size (partition database only)

Two TCL commands, SIZE-MONITOR and RESIZE-FILE, allow administrators to maintain optimally sized files on a partition database.