Prev | Advanced Operations Guide | Next |
Data
The commands in the Data menu allow you to import, export, and copy records in data files. You can also recover data after a system failure with the Roll Forward feature. See Roll Forward Command for a discussion of Roll Forward.
Importing and Exporting ASCII File Format
When you save data, records in the ASCII file have the following format. You can use an ASCII text editor to create files that you can load, as long as they adhere to these specifications. Note that most text editors do not support editing binary data.
- The first field is a left-adjusted integer (in ASCII) that specifies the length of the record. (When calculating this value, ignore the carriage return/line feed that terminates each line.) The value in this first field matches the record length specified in the data file.
- A separator (a comma or a blank) follows the length field.
- The record data follows the separator. The length of the data is the exact number of bytes specified by the length field. If you are creating an import ASCII file using a text editor, pad each record with blank spaces as necessary to fill the record to the appropriate length.
- A carriage return/line feed (0D0A hexadecimal) terminates each line. The Maintenance utility does not insert the carriage return/line feed into the data file.
- The last line in the file must be the end-of-file character (CTRL+Z or 1A hexadecimal). Most text editors automatically insert this character at the end of a file.
Figure 14-12 shows the correct format for records in the input ASCII file. For this example, the data file has a defined record length of 40 bytes.
Figure 14-12 Format for Records in Input Sequential Files![]()
Data Tasks
You can perform the following data tasks with the Maintenance utility:
- To import ASCII data
- To export ASCII records
- To copy records between MicroKernel data files
- To recover (Roll Forward) changes made to a data file between the time of the last backup and a system failure, see the Logging, Backup, and Restore chapter .
Importing Records From an ASCII File
You can use the Maintenance utility to import records from an ASCII file to a standard data file. This operation does not perform any conversions on the data. You can create an import file using a text editor or the Maintenance utility (see Exporting Records to an ASCII File ).
- Click Data4Load from the main menu. The Load dialog box appears (Figure 14-13).
Figure 14-13 Load Dialog Box![]()
The ASCII file you specify must adhere to the specifications explained in Importing Records From an ASCII File . The record length of the standard data file you specify must be compatible with the records in the ASCII file.
- Click Execute to import the records.
While importing data, the Maintenance utility shows the number of records being imported, the percentage of records imported, and a status message. You can continue working in the Maintenance utility (for example, you can open another Load dialog box).
Exporting Records to an ASCII File
You can use the Maintenance utility to export records from a data file to an ASCII file.
- Click Data4Save from the main menu. The Save Data dialog box appears (Figure 14-14).
Figure 14-14 Save Data Dialog Box![]()
- In the Save Data dialog box, specify the following options.
From MicroKernel File Specifies the name of the existing MicroKernel-compatible file you want to save. To Sequential File Specifies the name of the sequential file to create. Use An Index Uses a specified index when sorting the records for export. By default, the Maintenance utility does not use an index, meaning that records are exported according to their physical position in the data file. Internal Index #:
Uses the specified key number. Click Refresh Index List to update the available indexes if you change file in the From MicroKernel File box. External Index File:
Uses the specified external index. (To create an external index, refer to Creating Indexes .) Direction Forward: This is the default setting and indicates the utility recovers the file from the beginning.
Backward: This option recovers data from the end of the file.
Forward and Backward: This option reads the file forward until it fails. Then it starts at the end of the file and reads the file backward until it reaches the record that failed previously or encounters another failure.
Backward and Forward: Indicates the utility reads the file backward until it fails. Then it starts at the beginning of the file and reads the file forward until it reaches the record that failed previously or encounters another failure.- Click Execute to export the data. The Maintenance utility creates the specified ASCII file using the format described in Importing Records From an ASCII File . You can then edit the ASCII file and use the Load command to import the edited text to another standard data file, as described in Importing Records From an ASCII File .
Copying Records Between Data Files
You can use the Maintenance utility to copy data from one Microkernel data file to another. The record lengths for both data files you specify must be the same.
To copy records between MicroKernel data files
- Click Data4Copy from the main menu. The Copy Data dialog box appears (Figure 14-15).
Figure 14-15 Copy Data Dialog Box![]()
- Enter the name of the file you want to copy in the From MicroKernel File box and then specify the path where you want to copy the file in the To MicroKernel File box.
The record lengths for both data files you specify must be the same.
Recovering (Roll Forward) Changes to a Data File
See the Logging, Backup, and Restore chapter .
Prev Indexes |
Contents Up Check for Revisions | Next Btrieve Command-Line Maintenance Utility (BUTIL) |