File Manager - Keyed file menu

File Manager - Keyed file menu

The options on this menu execute the Sculptor keyed file utilities newkf, kfcheck, kfri and reformat. The detailed documentation on these utilities should be consulted for a full understanding of the utilities and their implications for Sculptor keyed files.

There are buttons on the main screen as alternative methods of performing these menu options on the currently displayed file; a button is also provided to check all files in the current directory.


New

Create a new keyed file or files. This option executes the Sculptor keyed file utility newkf, creating new, empty index and data files.

The Current file option creates new files for the record layout defined in the currently selected data dictionary, and empty files for any secondary indexes associated with the file.

Index and data files may already exist for the selected data dictionary. This is indicated by the display of checkmarks in the corresponding boxes on the top right of the main File Manager screen. The Records box displays the number of records contained in the file. If this box is blank, no records exist and the option can be executed without any data being lost. If the file already exists and contains records, the records will be destroyed. In this case, a warning is issued before the option is executed.

If a data dictionary’s structure has been changed and no records existed in the file, this option should be used to create empty files with the new structure. If the structure is changed and records exist, the Keyed file->Reformat option is available to reformat existing records to the new structure. In either case, all programs that declare the file must be recompiled.

The following options are available:

Index file only

Creates the file as index-only. This option is only enabled if the selected data dictionary consists entirely of key fields.

Turn off transaction logging

Check this box to turn transaction logging off. Unless this option is used, versions 4.2 or later of newkf update the transaction log file if it is present in the directory $SCULPTOR/recover. The default for this option is set on the Configure screen.

Size

The size of the new file. Files can be big or standard; see Maximum number of records; creating big files. If the file already exists, there is also an option to use the size of the existing file.

A further menu option is available to create new files for all the data dictionaries in the current directory.

The Index file only option is always enabled if a whole directory is selected. If the option is used, any file in the directory whose structure contains only key fields will be created without a data file. The option is ignored for files that have data fields.


Check

Check the integrity of a keyed file or files. This option executes the Sculptor file checking utility kfcheck, which verifies a keyed file index by checking that all record pointers are unique, and that any missing pointers belong to deleted records. If damage is reported, the Keyed file->Rebuild option can be used to rebuild the file.

The Current file option checks the currently selected keyed file.

The following options are available:

Integrity check level

Set the integrity check level. The higher the level, the more comprehensive the check, and the longer it takes to perform. Checks are cumulative; any check level performs all the checks carried out by lower levels.

See kfcheck Command line option -ln for full details of integrity check levels.

The default integrity check level (0-4) is set on the Configure screen.

Count deleted records

Displays a count of deleted records as well as checked records. As Sculptor automatically reuses deleted record space, this number will reduce to zero as new records are inserted.

Only display errors

Suppresses the output of all messages other than errors. If the file check is completed without any errors being found, nothing except the message “Finished” is output.

Stop on error

Stop if any error condition is encountered, without checking any further files.

If the file has secondary indexes, these are displayed in a table, and specific indexes can be selected for checking. This option is useful only in those cases where specific indexes are to be checked, and others excluded. To check all secondary indexes, set an integrity check level of 2 or higher.

Selection from the index table is by the standard methods for a multiple selection table. See Activating and selecting lines from a table.

A further menu option is available to check all the files in the current directory.


Rebuild

Rebuild the index of the currently selected keyed file from its data file. This option executes the Sculptor keyed file rebuild utility kfri. It can also be used to build or rebuild secondary indexes. This option should be used to repair any damage reported by the Keyed file->Check option, and, if a new secondary index is added to the data dictionary of an existing file, to build the new index.

The following options are available:

Rebuild main index

Rebuild the main index.

Rebuild all secondary indexes

Rebuild all secondary index files. This option overrides the Indexes table - that is, if it is selected, all indexes are rebuilt even if specific indexes have been selected in the table.

Pack index

Controls the way the index is packed. Records are physically stored on the disk in the order in which they were inserted. If this order is fairly random with regard to the key - that is to say, the records were not created in ascending key order - the index will be evenly packed. However, if the records were created in ascending key order, the index file created would be only half full, although its efficiency would be only marginally affected.

This option should only be used if it is absolutely certain that the keys were inserted in ascending key order., Entries will be packed into the leftmost page first, resulting in a smaller index file. Note that if this option is used on a file where the data was not inserted in key sequence, the resulting file may be larger than it would have been otherwise.

Display count

Displays a count every 1000 records processed.

If the file has secondary indexes, these are displayed in the Indexes table. To specify a specific index or indexes for rebuilding, select them from the table. Selection is by the standard methods for a multiple selection table. See Activating and selecting lines from a table.


Reformat

Reformat existing data in the current file to match amendments to the file structure resulting from editing the data dictionary. This option executes the Sculptor keyed file utility reformat. All secondary indexes are rebuilt automatically. After a file has been reformatted, all programs that declare the file must be recompiled.

Not all changes to a data dictionary require a reformat. A reformat need only be run if one or more of the following changes is to be made:

1

A field is added.

2

A field is removed.

3

The position of a field is changed.

4

A field’s name is changed.

5

A field’s type or size is changed.

6

A field’s number of dimensions is changed.

7

A field’s logical type is changed.

8

A field is changed from key to data or vice versa.

It is not necessary to reformat a file unless the main index is altered. To change a secondary index’s record layout, use the Data Dictionary->Edit option, and then use Keyed file->Rebuild to rebuild the index.

One further use of reformat is limited to files that have key fields only. Such files may, optionally, be created as index-only. No data file exists for such a file. The reformat operation may be used to change a file’s index-only status, adding or removing a data file. If this is the only modification to be made, it is not necessary to edit the data dictionary.

A reformat is a multistage operation, and it is essential that the stages are performed in the correct order. These correspond to the buttons in the centre of the Reformat window. As each stage is completed, the corresponding box in the Progress group is ticked.

1

Rename files. The reformat operation requires the index and data files to be renamed, and the data dictionary to be copied before it is edited. A temporary file name is required for these files. The name may be entered in the Temporary file name box. If no name has been provided, Sculptor offers to generate a temporary file name automatically when the Rename files button is pressed.

2

Edit the data dictionary. The ddeditor program is called for this purpose. This stage is not necessary if the reformat operation is being run only for the purpose of changing a file’s “Index only” status. The Start button is therefore enabled before this stage has been executed.

3

Start the reformat.

The Cancel button can be used to cancel the reformat operation at any point. If the Rename files or Edit data dictionary operations have already been performed, they are reversed, restoring the file to its original state.

The following options are available:

Display count

Displays a count every 1000 records processed.

Turn off transaction logging

Check this box to turn transaction logging off. Unless this option is used, versions 4.2 or later of reformat update the transaction log file if it is present in the directory $SCULPTOR/recover. The default for this option is set on the Configure screen.

Index only

Create the file as index-only. This option is only available if the key length and record length are equal.

Size

The size of the reformatted file. Files can be big or standard; see Maximum number of records; creating big files. The default is to use the size of the old file.

When the reformat is completed and the output screen closed, the Reformat window is redisplayed, with the following two options:

Delete temporary files

Deletes the temporary files that were created by the Rename files option. These are a copy of the file in its pre-reformatted state. They can be loaded, viewed and deleted by File Manager in the same way as any other file.

OK

Closes the Reformat window and returns to the main screen.

It is strongly recommended that the file be backed up before reformatting. The File->Copy option menu option can be used for this purpose.

See Changing an existing data dictionary for details of the implications of editing an existing file that contains records.


RELATED TOPICS

File Manager