PreviousCOBOL Source Information Data File Editor TutorialNext"

Chapter 4: Data File Editor

The Data File Editor is a data tool that enables you to tailor data files as input for program testing, and view data files created by a program as an indication of its correct operation. You can view and edit data as records formatted against your program specification, with minimal set-up work.


Warning: Striped files are not supported by Data File Editor.


4.1 Introduction

The Data File Editor lets you view and edit all Micro Focus supported types of data files, with records either displayed as simple character strings or formatted according to record descriptions extracted from your programs.

This enables you to tailor data files to provide more finely tuned test data for your applications, and also to easily view any data files output by your applications as an indication of their operation.


Note: To use the Data File Editor, LINES should be set to 25.


4.1.1 Display

Records are displayed as simple character strings (in unformatted mode) or as fields formatted against a record description extracted from your programs (in formatted mode). You select record descriptions from a list of all data items defined in a program that has been syntax-checked by the Compiler. Conditions can be associated with those formats so that the correct format is automatically applied to each record.

4.1.2 Editing

You edit data by over-typing existing data; this replaces the current record.

Records held in any file type can also be inserted or deleted. Your file is updated when it is saved. This mode requires the whole file to be loaded and might not, therefore, be suitable for large files.

Data can be edited in character mode or in hexadecimal mode.

4.1.3 Keys

Indexed files are sequenced by their key fields. You can select which key is currently active, giving the sequence. You can also search for particular values on any key. In unformatted mode, key data is highlighted.

4.1.4 Searching

You can search for text strings in your file. The string can be entered in character or hexadecimal format.

4.2 Invoking the Data File Editor

You can invoke the Data File Editor either from the Server Express Integrated Development Environment (SDE) or from the command line. When you invoke the Data File Editor, it uses the settings in the local configuration file to determine character set, edit mode and whether or not to perform backups or output warnings. See the section Data File Editor Configuration File later in this chapter for details of this file.

If you want to use the Data File Editor to display only unformatted data, no preparatory steps are required.

If you want to display data formatted according to record descriptions in your program(s), you must first load the .str file produced by the Structure Selector (see the section Structure Selector later in this chapter). This file holds one or more record structures which can then be directly or automatically applied to records to produce a display of the data in formatted mode.

The functions of the Data File Editor are accessed through menus. From some menus you can display other menus called the Alternate and Control menus. These menus are accessed using the Alt and Ctrl keys. These keys are toggle keys. See the appendix UNIX Key Usage Chart for further information on these keys.

4.2.1 Invoking From the SDE

To invoke the Data File Editor from the SDE, select F4=data-file-editor from the Alternate menu. This takes you into the Data File Editor. The initial entry menu is displayed in Figure 4-1.



Figure 4-1: Data Editing Menu

The first step you must take is to either load your file using F3=load-file, or create a new file using F5=new-file; both options are on the Alternate menu.

You can also enter Structure Selector without loading a file using F8=structure-selector on the Alternate menu.

4.2.2 Invoking From the Command Line

The three command lines you can use to invoke the Data File Editor are shown below. For any, you can either specify entry parameters so that you invoke the Data File Editor and load your file straight away, or you can have the Editor prompt you for the parameters.

dfed [filename] [{-A|-E}] [{-B|-b}]

where the parameters are:

filename Name of the file you want to edit. This parameter is optional. If you do not specify filename, you have to load a file once the Data File Editor is invoked.
-A Specifies that the file uses the ASCII character set.
-E Specifies that the file uses the EBCDIC character set.

If you do not supply either -A or -E, the value specified in the configuration file is used. If there is no configuration file, ASCII is assumed. You can also toggle between ASCII and EBCDIC from the Data File Editor menus.

-b Sets the backup option on. Your source file is copied to filename.dbk before any editing is performed. If this option is omitted, the value specified in the configuration file is used. If no configuration file exists, the backup option is assumed to be on. If the file is indexed, the index is copied to filename.ibk. Make sure you have sufficient disk space before setting this option on. If there is insufficient disk space for back-up you are positioned in the Load File menu.
-B Sets the backup option off.

filename, -A or -E, and -B or -b can be specified in any order.

4.2.3 Data File Editor Configuration File

Whenever you invoke Data File Editor, it searches for the local configuration file. See the chapter Configuring Development Tools in your Getting Started.

This configuration file contains the following parameters:

[DFED] Defines the name of the configuration details
BACKUP: Set to either ON or OFF
CHAR-SET: Set to either ASCII or EBCDIC
EDIT-MODE: Set to either FULL or QUICK
UPDATE-WARNING: Set to either ON or OFF

You can change the settings in the configuration file using a text editor such as the COBOL Editor.

4.3 Working with EBCDIC Files

EBCDIC is a data format commonly used on IBM mainframes and supported by Server Express. ASCII is the format normally used on personal computers.

Once you load a file, you can switch between the two formats using the toggle-character-set option on either the Load File menu or the Data File Editor Control menu. The Data File Editor operates with ASCII and EBCDIC files in the same way.

4.4 Data Editing Screen

The data editing screen is the first screen loaded by the Data File Editor. It is displayed with the Data File Editor main menu.

When you load a file by pressing F3=load or F5=new-file on the Alternate menu, the message prompt telling you to do either of these disappears and more menu functions on the menu become available.

When you load a file, the Data Editing screen displays record details and the file contents. The Structure Selector screen enables you to specify the record format (see the section Structure Selector later in this chapter).

The record details are displayed on the status line. These are Col, Rec-start, Len and the character set for the current file:

Col For unformatted mode, shows the byte in the record currently being edited and, for formatted mode, shows the byte in the field currently being edited.
Rec-start For unedited records, shows the position in the original file at which the record begins and, for edited records, shows the position in the file once you have saved it.
Len Shows the length of the record currently being edited.

The main menu is displayed at the bottom of the screen. You can replace this with the Alternate or the Control menu by pressing and holding the Alt or Ctrl keys respectively. The Alternate menu contains functions which operate on the display of the file records and also enables you to load a data file. The Control menu contains functions for handling keys and performing searches. Your current position in indexed files is shown by highlighted index keys.


Note: The COBOL syntax OCCURS DEPENDING ON is not supported. The data item is set to the maximum size.


You can obtain information about the file at any time by pressing F10=file-info on the Alternate menu. This displays the Configuration Screen menu. All of the current file's details are displayed. If the file is indexed, you can examine any key defined in the file using space=examine-key, or you can change the read key.

The data is displayed in either formatted or unformatted mode. The display is initially unformatted; F2=toggle-format switches between the two modes of display.

4.4.1 Unformatted Mode

The data is displayed as a string of raw data. Several records can be displayed, one record per line. Wide records extend off the screen. By default, the first 69 (or fewer, if the record contains fewer than 69 characters) characters of the first 21 (or fewer, if the file contains fewer than 21 records) records are displayed. If you have a larger screen and are using the +C RTS switch, more records can be displayed. This mode uses a highlight to indicate the current record.

The numbers displayed on the left hand side of the screen are the byte offset at which the record starts in the file for files other than relative. Where a file header exists, the offset includes 128 bytes of header information so the record might not start at byte offset 0.

When editing a file in unformatted mode, the field(s) which form the currently selected key and all alternate keys are highlighted.

Figure 4-2 shows the unformatted mode of display.



Figure 4-2: Data Editing Screen - Unformatted Data

4.4.2 Formatted Mode

This mode is available only after you load an .str file. The .str file is produced by the Structure Selector and holds one or more record structures which can be applied directly or automatically to the record so that data is displayed in its expected format. One record is displayed at a time. The first 21 (or fewer, if the record contains fewer than 21 fields) fields of the current record are displayed. Wide fields extend off the screen.

This mode uses a highlight to indicate the current field.

In formatted mode, any REDEFINES clauses are updated only when the cursor is moved off the field containing the REDEFINES clause. Similarly, group items are updated only when the cursor is moved off the group item.

Figure 4-3 shows the formatted mode of display.



Figure 4-3: Data Editing Screen - Formatted Data

4.4.3 Hexadecimal Editing

The Data File Editor can display the hexadecimal values of record contents, and enables you to change the values displayed. In this way, you can edit non-display characters, or enter invalid characters into numeric fields (for testing purposes).

Once you have invoked the vertical hexadecimal display using F2=toggle-hex from the Alternate menu, the screen display changes so that the hexadecimal values are shown underneath the character display. Figure 4-4 shows a screen in unformatted mode with a hexadecimal display.



Figure 4-4: Data Editing Screen - Hexadecimal Unformatted Data

Figure 4-5 shows a screen in formatted mode with a hexadecimal display.



Figure 4-5: Data Editing screen - Hexadecimal Formatted Data

The top line of the hexadecimal display contains the most significant nibble of a byte, and the bottom line contains the least significant nibble. Invalid numeric data in formatted mode moves zeros to the numeric field.

4.4.4 Keys Used for File and Data Navigation

The following keys are defined to navigate your file when the data is displayed in unformatted mode:

Key
Function
<left-arrow> Moves the cursor left one character position.
<right-arrow> Moves the cursor right one character position.
<up-arrow> Moves to the next record. If you are using the vertical hexadecimal display, this key also enables movement to the next two nibbles of the current byte of the record.
<down-arrow> Moves to the previous record. If you are using the vertical hexadecimal display, this key also enables movement to the previous two nibbles of the current byte of the record.
Tab Moves the cursor eight bytes forward in the file.
Shift+Tab Moves the cursor eight bytes backward in the file.
Home The first time you press Home, the cursor moves to the start of the screen. The second time moves the cursor to the start of the record. If the cursor is already at the start of the record, it moves to the top of the screen.
End The first time you press End, the cursor moves to the end of the screen. If the cursor is already at the end of the screen, it moves to the end of the record. If the cursor is already at the end of the record, it moves to the base of the screen.
Page Up Moves the current record backward. The number of records moved depends on the number of lines displayed on your screen.
Page Down Moves the current record forward. The number of records moved depends on the number of lines displayed on your screen.
Ctrl+Home Moves to the start of the data file.
Ctrl+End Moves to the end of the data file.
Ctrl+<left-arrow> Moves the current record across the screen to the left. The number of bytes moved depends on the number of bytes displayed on your screen.
Ctrl+<right-arrow> Moves the current record across the screen to the right. The number of bytes moved depends on the number of bytes displayed on your screen.
Backspace Moves the cursor back one space and places a space at the new position.

The following keys are defined to navigate your file when the data is displayed in formatted mode:

Key
Function
<left-arrow> Moves the cursor left one character position.
<right-arrow> Moves the cursor right one character position.
<up-arrow> Moves to the next field. If you are using the vertical hexadecimal display, this key also enables movement to the next two nibbles of the current byte of the record.
<down-arrow> Moves to the previous field. If you are using the vertical hexadecimal display, this key also enables movement to the previous two nibbles of the current byte of the record.
Tab Moves the cursor eight bytes forward.
Shift+Tab Moves the cursor eight bytes backward.
Home The first time you press Home, the cursor moves to the start of the field. The second time moves the cursor to the start of the screen. If the cursor is already at the start of the field, it moves to the top of the screen.
End The first time you press End, the cursor moves to the end of the field. The second time moves the cursor to the end of the screen. If the cursor is already at the end of the field, it moves to the base of the screen.
Page Up Moves the current field backward. The number of fields moved depends on the number of lines displayed on your screen.
Page Down Moves the current field forward. The number of fields moved depends on the number of lines displayed on your screen.
Ctrl+Home Moves to the start of the record.
Ctrl+End Moves to the end of the record.
Backspace Moves the cursor back one space and places a space at the new position.
Ctrl+<right-arrow> Moves the page to the left.
Ctrl+<left-arrow> Moves the page to the right.

4.5 Editing Records

To edit a record, use the cursor keys to highlight the line you want to change, and key in the new values. You can also insert or delete records for any file type.

4.6 Adding Records

You can add records either before the current record by pressing F3=insert-record, or after the current record by pressing Enter. Note that pressing Enter works only when Insert is on. For relative files, a record number is requested when inserting the record. If a structure file is already loaded when you try to insert a record, a list of all the available structures is displayed. You can either select one of these structures and insert it, or you can insert spaces.

4.7 Working with Indexed Files

When you load an indexed file, the Data File Editor determines your file organization from the file header, so you do not need to tell it whether you have an indexed file or not.

If your data file has one or more keys, the file records are automatically sorted according to the currently selected key. This defaults to the prime key; you can change it subsequently using F2=change-read-key on the File Info menu. If the current key enables duplicate values and these exist in your file, they are ordered into blocks of identical key values. The ordering in those blocks is determined by the order in which the records were written into the file.

You can search for particular values of the current key and you can change key values.

If you change the value of a key in your file, the logical sequence of the file is updated according to that change before the next operation is executed. So if you move to the next record, and the key change you made has caused your previous record to move to a new logical position in the file, the next record is selected according to the changed record.

If a key is not allowed duplicate values, you are prevented from creating any such values.

4.8 Searching Data Files

The F2=search function enables you to search for data strings in a file in either formatted or unformatted modes, and in either text or hexadecimal format.

In unformatted mode, the search is made for a string matching the search string. In formatted mode, the search is made for a field with a value matching the one you enter.

The three search functions are:

search-on-current-key The search-on-current-key function is for use with indexed and relative files only. Search-on-current-key automatically selects the current key to search on. You need not specify the whole key.
search-on-key The search-on-key function is for use with indexed files only. Search-on-key enables you to search for a particular record using its key value. It lists the available keys to search on and enables you to select one.
search The search function, in unformatted mode, performs a string search, and in formatted mode searches on the current field.

Pressing Ctrl+Break aborts a search.

4.9 Structure Selector

The Structure Selector enables you to apply structures to records displayed in formatted mode.

The structures are contained in an .idy file. The .idy file is created by the Compiler if you use the ANIM directive when checking a program containing record descriptions of your file. All level items in the Working-Storage, File or Linkage Sections are considered candidates for record descriptions and are made available for selection.

You call the Structure Selector by pressing F8=structure-selector from the Alternate menu. When you do this, you are prompted for the name of an .idy file.

Once the .idy file is loaded, it is displayed on the screen in the format shown in Figure 4-6. The current record structure is highlighted.



Figure 4-6: Structure Selector Screen

4.9.1 Assigning a Record Structure

You can assign a record structure to a record, so that every time that record is displayed, it is displayed in that chosen structure.

To assign a structure, you move the cursor up or down the screen to the structure you require and then press one of:

F6 F6=accept-default-structure assigns the selected structure as the default structure for the record, to be used in the formatted mode of the Data File Editor.

A message is displayed giving the character set to be used, which is the same as that in the .idy file, and depends on whether or not the .idy file was produced with the EBCDIC option set.

F7 F7=accept-conditional-structure assigns a conditional structure so that only records associated with this structure are displayed with that format. For example, a particular record format can apply only to records with the value "1" in the first byte of a record. You can set the condition so that the record format is only applied to records where the first byte is equal to the value "1".

A window appears containing the structure you selected. You now have to apply conditions to the elementary fields of this structure. The conditions are used to decide which structure to apply to records displayed in formatted mode.

To define a condition, move the cursor to the required elementary field and press Enter. This causes a window to appear enabling entry into that field. When you have defined the value for this field, press Enter.


Note: At this point, you can enter the value in either hexadecimal or text format.

Once a field has a condition assigned to it, it has an asterisk (*) beside it.

When all the required definitions for the record are defined, press F7=accept-conditional-structure to commit the structure or Escape to disregard the structure. If you commit the structure, it appears in the Structure List box at the top right of the Structure Selector window. You can hide this box by pressing F5=structure-box.

Note that large arrays take some time to generate and produce large .str files.

Example:

Consider the following example code extract:

 01 name.
     key-fld        pic x.
     first-name pic x(30).
     last-name      pic x(20).

 02 address.
     key-fld        pic x.
     street     pic x(50).
     town           pic x(20).

To create two conditional structures in this example:

  1. Select NAME from the Structure entry window by pressing F7.

  2. Select KEY-FLD from the Field window by pressing Enter.

  3. Enter the value "N" in the Field entry window.

  4. Press Enter to commit these selections and F7 to commit this structure.

  5. Select ADDRESS from the Structure entry window.

  6. Select KEY-FLD from the Field window by pressing Enter.

  7. Enter the value "A" in the Field entry window.

  8. Press Enter to commit these selections and F7 to commit this structure.

Now all records in the Data File Editor beginning with "N" have the NAME structure applied to them and all structures beginning with "A" have the ADDRESS structure applied to them as follows:

NA.N.Other
A55 A Street    A town
NB.Bloggs
A32 A Long Street   A city

If the .str file has the same name as the data file, it is automatically loaded.

4.10 Creating a New File

If you press F5=new-file on the Alternate menu, the screen displays the file creation window (see Figure 4-7).



Figure 4-7: File Creation Window

From this window you can create any type of Micro Focus file. Some of the options on the file creation window might not be highlighted, which means that either they are not relevant for the file type you want to create, or an entry into a corresponding highlighted field is required before they become highlighted and available. For example, only indexed files allow keys to be defined, so for every other file type, the keys option cannot be highlighted.

To move around this window, you press either Tab or Backtab. To select an option, you press Space, which moves the cursor to the next available field, and selects the option.

To create a new file, you must first select a file organization from the drop-down list box. You should now specify if the file is to be of fixed- or variable-length. If you select fixed-length, the minimum record length field is not available.

Next you should specify the record length(s), and the character set which can be either ASCII or EBCDIC.

If you want your file to use data compression, select the ON option.

Next, you specify the format of the file. The formats you can select are:

Micro Focus format
IDXFORMAT"4" format
IDXFORMAT"8" format

If the file defined is not indexed, pressing Enter at this time creates the file. If, however, the file is indexed, you must select F2=define-keys to create keys for the file. The way you define keys is described in the section Defining Keys for an Indexed File below.

4.10.1 Defining Keys for an Indexed File

The F2=define-key function on the Create File menu enables you to define and change keys of the indexed file. The first key definition screen displayed is for the prime key (see Figure 4-8). Subsequent key definition screens are for alternate keys.



Figure 4-8: Define Keys Screen

You press the Tab and Backtab keys to move forward and backward through the fields, entering "Y" to overwrite the default "N" if you want an option, or tabbing to the next field if you do not.

Each key can have any of the following options set:

Key options:

Duplicates allowed If this key is to allow duplicates.
Sparse character If this key is to have a sparse character, which you must enter.

Key compression options:

Leading spaces If leading spaces are to be compressed on this key.
Trailing spaces If trailing spaces are to be compressed on this key.
Duplicates If duplicates are to be compressed on this key.

You should then define the key range in the format:

start1:length1,start2:length2

where this example defines a split key with two components and the parameters are:

start Starting position in the record from 1.
length Length of the key.

You can now add the key to the key list by pressing Enter. The next and subsequent screens are for alternate keys.

When you have finished the key definitions, you press Escape, which commits all of the file definitions you have just made. You are returned to the Create File menu.

4.11 Functions

This section describes how to use the functions shown on the menus in the Data File Editor. Prompts and field-names are included. They are all ordered alphabetically. The menus indicate which key you should press to invoke a function. For those functions that appear on submenus, the submenu is identified.


accept-conditional-structure

Assigns a conditional structure so that only records associated with this structure are displayed with that format.

Available on the structure-selector menu.

For more detailed information, see the section Assigning a Record Structure.


accept-default-structure

Assigns the selected structure as the default structure for the record, to be used in the formatted mode of the Data File Editor.

Available on the structure-selector menu.

For more detailed information, see the section Assigning a Record Structure.


ascend-level

In either compressed or expanded mode, if the cursor is positioned on a group item, the display is replaced by a display of the superordinate levels of the current data item.

Available on the structure-selector menu.


compress/expand

You can either expand the current group item so that all sublevels of that group item are displayed on the Structure Editing screen, or you can compress an expanded current group item so that only that level of the group item is displayed.

Available on the structure-selector menu.


copy-record

Insert the current record into the file. If this is an indexed file, unless all the keys on the file allow duplicates, this option fails.


create-file

Creates a new file.

You must first clear any existing file. You do this by pressing Escape.

You enter the name of the file you want to create at the prompt on the screen, then press Enter. The File Creation screen appears so that you can enter details of your new file.

Available on the Alternate menu.


delete-record

Deletes the current record. If the file is an indexed file, and the current record defines a key in the file that does not exist, the delete fails.


delete-structure

Pressing F4=delete-structure enables you to select a structure from the structure box using the cursor keys and to delete the specified structure. You are asked to confirm that this is what you want to do. If you respond with "Y", the structure is deleted.

Available on the structure-box menu.


descend-level

In either compressed or expanded mode, if the cursor is positioned on a group item, the display is replaced by a display of the subordinate levels of the current data item.

Available on the structure-selector menu.


directory

Enables you to use the Directory functions to locate your file.

Available on the load-file menu.


edit-structure

Pressing F3=edit-structure enables you to select a structure from the structure box using the cursor keys and to edit the conditions on that structure.

Available on the structure-box menu.


field/picture

Shows the picture definition of the data being displayed and the relative part of the data record containing the current field (position followed by length). This function is available only in formatted mode and is an alternative to Display-field-names.

Available on the Control menu.


file-info

Displays the Configuration Screen which contains information on the currently loaded file. Figure 4-9 shows an example of such a display.

Available on the Alternate menu



Figure 4-9: File Information Screen

The information includes:

For indexed files, the Configuration Screen menu enables you to change the read key which sets the current sort key for your file to that displayed on the status line. If the current display is unformatted, the bytes that make up the key are highlighted.

You can also use the <up-arrow> and <down-arrow> cursor movement keys to move the highlight up and down the key list box. You can examine any key in the box by pressing Space when it is highlighted.


go-to-byte

Asks for the number of the byte in the record to which to move, then displays that area of the record.

Available on the Control menu.


go-to-Nth-record

Asks for a record number in the file and performs a sequential read through the file until it finds the record. This can take some time for very large files.

Available on the Control menu.


group-copy

The group-copy function prompts you to enter the number of times you want to copy the current record, then inserts the current record that many times below the current record. This function is not available for indexed and relative files.

This function is available on the record-group-edits menu.


group-delete

The group-delete function prompts you to enter the number of times you want to delete a record, then deletes that many records below the current record.

This function is available on the record-group-edits menu.


group-insert

The group-insert function prompts you to enter the number of times you want to insert a record, then inserts a record that many times below the current record. This function is available only for sequential files.

This function is available on the record-group-edits menu.


help

Provides help information for the current screen.


init-record

Sets the data in the record to default values. If a record structure file is loaded, it is used to:

If no record structure is available, the record is filled with spaces.


insert-record

In both unformatted and formatted mode, attempts to add a record to the current file. If the .str file is loaded, all of the available structures are listed. If it is not, spaces are used.

If a structure is selected on a variable-length file, the structure length is used as the record length.

If the file is relative, you are prompted for the relative record number at which to place the record. You are warned if you are about to overwrite an existing record and given an opportunity to escape.

If the file is indexed, the addition of duplicate key values is allowed only if they are allowed by the file definition. You are warned if you are adding a duplicate key. You are not allowed to leave the record until you include key values allowed by the file definition. The record is initially filled with spaces.


list-structures-to-file

Lists the current structure file's details to a file with the extension .lst

The file .lst contains details of the file from which the structure was taken, field information for all fields in the structure and key information for all keys in the file from which the structure was taken.

Available on the structure-box menu.


load-file

Before you load a file, you must press Escape to clear any existing file. Pressing F3=load-file on the Alternate menu displays the Load File menu (see Figure 4-10). Type in the name of your file or select it using the directory function.



Figure 4-10: Load File Menu

If you specify a fixed-length record sequential or relative file, a panel appears prompting you for the record length. A new menu enables you to select the file organization. This menu is shown in Figure 4-11.



Figure 4-11: File Organization and Record Length

The Load File menu contains the functions shown below:

For a description of the functions on this menu, see directory, toggle-backup, and toggle-character-set.


load-str-file

Loads a previously saved structure description file (usually with the same name as the data file and a file extension of .str) to format the current record.

Available on the Alternate menu.


nxt-rec

In unformatted mode, highlights on the next record.

In formatted mode, sets the values of the displayed data fields to the values in the next record.


prv-rec

In unformatted mode, highlights on the previous record.

In formatted mode, sets the values of the displayed data fields to the values in the previous record.


record-group-edits

Enables you to edit a group of records and displays its own submenu.

For a description of the functions on this menu, see group-insert, group-delete, and group-copy.

This function is available on the Alternate menu.


repeat-srch

Repeats the last search requested. If no search has been attempted, an error message is issued. To interrupt a search, press Ctrl+Break.

Available on the Control menu.


save-as

Enables you to save your current file with a different name. When you do this, the new name is displayed at the top of the Data Editing window.

Available on the Alternate menu.


save-file

Saves the file displayed on the Data Editing screen to its current name.

Available on the Alternate menu.


save-str-list

Enables you to save the definition of your record structures to be used at a subsequent editing session (use the load-str-file function to load the file in). We recommend that you use a file extension of .str for your file. When a data file is loaded, if a file with the same filename and the .str extension is found, it is automatically loaded.


search-on-current-key

Available only for relative and indexed files; enables you to perform a search on the current key.


search-on-key

Enables you to search for a specified record. This function lists the available keys and requests the key on which to search. Search-on-key is available only for indexed and relative key files. You can search for keys in either ASCII or EBCDIC mode. Search-on-key displays its own submenu .

For a description of the functions on this menu, see search (=), search (>=), search (<=), search (>), and search (<).


search (=)

Search for a key value equal to the value you specify.

If the current file is an indexed file, you are prompted for a value for the key you want to find. You can enter this value either in text or hexadecimal format. This key value is searched for and, if found, the record containing that key becomes the current record (if the value is duplicate, the first record in the block of duplicate values is displayed). Split keys are concatenated into one string for entry purposes.

If the current file is a relative file, you enter the relative record number of the required record.

Available on the search-on-key menu.


search (>=)

The search (>=) function enables you to search for a key value greater than or equal to the value you specify.

If the current file is an indexed file, you are prompted to enter a value greater than or equal to the key you want to find. You can enter this value either in text or hexadecimal format. The key value is searched for and stops at the first occurrence of the specified key value. Split keys are concatenated into one string for entry purposes.

If the current file is a relative file, you enter the relative record number of the required record.

Available on the search-on-key menu.


search (<=)

Search for a key value less than or equal to the value you specify.

If the current file is an indexed file, you are prompted to enter a value less than or equal to the key you want to find. You can enter this value either in ASCII or hexadecimal format. The key value is searched for and stops at the first occurrence of the specified key value. Split keys are concatenated into one string for entry purposes.

If the current file is a relative file, you enter the relative record number of the required record.

Available on the search-on-key menu.


search (>)

Search for a key value greater than the value you specify.

If the current file is an indexed file, you are prompted to enter a value greater than the key you want to find. You can enter this value either in ASCII or hexadecimal format. The key value is searched for and stops at the first occurrence of the specified key value. Split keys are concatenated into one string for entry purposes.

If the current file is a relative file, you enter the relative record number of the required record.

Available on the search-on-key menu.


search (<)

Search for a key value less than the value you specify.

If the current file is an indexed file, you are prompted to enter a value less than the key you want to find. You can enter this value either in ASCII or hexadecimal format. The key value is searched for and stops at the first occurrence of the specified key value. Split keys are concatenated into one string for entry purposes.

If the current file is a relative file, you enter the relative record number of the required record.

Available on the search-on-key menu.


search

Search for data strings in a file each up to 512 bytes in length in either formatted or unformatted modes.

In unformatted mode, the search proceeds for a string matching the search string.

In formatted mode, the search proceeds for a field with a value matching the one you enter.

A search string window is displayed, prompting you to enter a search string. You can choose the direction in which the search is to run by pressing the F2=toggle-search-direction toggle. The search direction is displayed in the information line. By default, the search direction is forward.

If the search string or field cannot be found, the message:

could not find a matching string

or:

could not find a matching field

is displayed.

To interrupt a search, press Ctrl+Break.


set-rec-len

Sets the current record's length to the cursor position. If this length is less than the minimum length for the record, a warning is displayed and the request is ignored. This function is not available for fixed length files.


structure-box

Displays its own submenu.

For a description of the functions on the structure-selector menu, see delete-structure, edit-structure, and list-structures-to-file.

Available on the structure-selector menu.


structure-selector

Invokes the Structure Selector. This function enables you to load .idy files and extract record structures from them to produce .str files. You can then use these to format data.

Available on the Alternate menu.

For a description of the functions on the structure-selector menu, see compress/expand, ascend-level, descend-level, structure-box, accept-default-structure and accept-conditional-structure.


toggle-backup

Switches file backup on and off. The display on the status line changes between "No Backup" and "Backup". When backup is on, the Data File Editor makes a backup copy of your file before any changes are allowed.

You must have sufficient disk space for a copy of your file to be made if you set the backup option on.

Your data file is copied to filename.dbk and, if the file is an indexed file, a copy is also taken of the index and named filename.ibk. filename is the name of your file.

If any mistakes occur while you are editing, these files can be copied back to your original names thus reversing any changes made while editing.

Available on the load-file menu.


toggle-character-set

Switches the specification of the character set of your file between ASCII and EBCDIC.

Available on the load-file menu.


toggle-format

Changes the display between formatted and unformatted modes. This function is available only when you have created or loaded a .str file. The function key is not highlighted if an .str file is not loaded.


toggle-hex

The toggle-hex function switches the display of vertical hexadecimal on and off.


undo-edit

Pressing F6=undo-edit on the Data File Editor main menu restores the current record to the state it was in when it was made current.


4.12 Data File Editor Messages

The messages displayed by the Data File Editor are either error messages or information messages. These are described in the following sections.

4.12.1 Error Messages

DFD001 File type is indexed, keys must be defined
DFD003 No valid structure is available for this record
DFD004 Could not find a matching field
DFD005 Could not find a matching string
DFD006 First select a key from the key list
DFD012 Record required for formatted mode, please select one
DFD014 File not found
DFD015 Cannot set record length to less than the minimum xxxxx
DFD016 Your position is not in the permissible lengths for this record
DFD017 Record beyond number end of file
DFD018 Record not added, invalid duplicate on key X
DFD019 Record length is not in the range 1 to 63488 (62K)
DFD020 Minimum record length is greater than maximum record length
DFD022 File format is unsuitable for file organization
DFD023 Component XX of key is invalid
DFD026 Cannot edit, file is locked
DFD027 Cannot create, target file is locked
DFD028 Cannot save to file, file is locked
DFD030 Save failed, insufficient disk space
DFD031 Back up failed. Could not open file
DFD032 Back up failed. Could not create back up file
DFD033 Back up failed, insufficient disk space
DFD035 Could not load, file is not a structure file
DFD038 Press Escape to clear current file before loading
DFD039 Press Escape to clear current file before creating
DFD040 Cannot go to end of file during loading
DFD041 Invalid filename
DFD042 File opened read only
DFD045 Index corrupt, use re-build before attempting to edit
DFD046 Could not access help files
DFD047 Structure is smaller than minimum record length, minimum used
DFD048 Component XX of key is longer than maximum record length
DFD049 Component XX of key is longer than minimum record length
DFD051 First specify item to search on
DFD052 Floating point can only be edited through hex
DFD053 Deletion failed: A record with the specified key could not be found
DFD055 Only deleted X records
DFD056 Could not find matching record
DFD057 EXTFH module missing, could be data data module compression missing
DFD099 Insufficient memory to allocate for key block

4.12.2 Information Messages

Alterations canceled
Could not load file, no idx file found
Field has no children
Field has no parent
File exists, overwrite (Y/N)?
Item has no children
Press Alt+F3 to load a file Alt+F5 to create a file
Record already exists at this number, overwrite (Y/N)?
Search quitted
Structure larger than maximum record size, bytes beyond XXXXX ignored
Unsaved file, exit (Y/N)?

4.13 Structure Selector Messages

The messages displayed by the Structure Selector are either error messages or information messages. These are described in the following sections.

4.13.1 Error Messages

STRT001 Modifying structure
STRT002 Top of field list, no more fields
STRT003 End of field list, no more fields
STRT004 No structures stored
STRT005 Cannot add structure, no condition has been specified
STRT007 Default structure assigned
STRT008 Default unaltered
STRT009 Structure deleted
STRT010 Deletion of structure aborted
STRT011 Structure added
STRT012 Structure edited
STRT014 Update aborted, structure deleted
STRT015 Field has no parent
STRT016 Field has no children
STRT017 Structure list empty
STRT018 Cannot select an information field
STRT020 Bad IDY file, could not load
STRT024 Could not load, file is not a structure file
STRT025 Cannot edit conditions for default structure

4.13.2 Structure Selector Information Messages

Assumed ASCII character set for conditions
Assumed EBCDIC character set for conditions
Default structure has already been defined, alter it (Y/N)
Are you sure you wish to delete this structure (Y/N)
Generating structure, please wait...
Listing structures to file
Unsaved structures, are you sure you wish to exit (Y/N)


Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousCOBOL Source Information Data File Editor TutorialNext"