PreviousOverview of Working with Data Files Converting Data FilesNext"

Chapter 11: Editing Data Files

This chapter describes the Data File Editor which is the tool that Mainframe Express provides for creating and editing data files on your PC.

For detailed information about using the Data File Editor, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, click Development Environment, Working with Data Files, Editing.)

11.1 Overview

Use the Data File Editor to:

11.2 Switches and Warnings

The switches and warnings described below apply specifically to the Data File Editor. There are other settings that you can change for the Data Tools in general. For more information, see the section Data Tools Settings in the chapter Overview of Working with Data Files.

The Data File Editor has two types of setting: switches and warnings.

11.2.1 Switches

You can control whether you:


Note: The above switches take effect the next time you open a data file in the current session. Therefore, when you change one of these settings, the new setting does not take effect for any data files you have open currently.


11.2.2 Warnings

The following warnings and warning message are designed to help you avoid changing or deleting data inadvertently. When you:

Initially, warnings are switched on. You can switch off the warnings for the current session and all future sessions.The new setting for a warning takes effect when you next open a data file. Therefore, the new setting does not apply to any data files that are currently open.


Note: You can stop a message appearing again for the current session only by checking Do not show this message again on the warning message box.


11.3 Creating Data Files

You can use Data File Editor to create both mainframe-style and PC-style data files.

If you create indexed files, you need to define their keys. For more details, see the section Defining Keys for Indexed Files.

11.3.1 Mainframe-style Files

A mainframe-style file is also known as a data set. This type of file is a cataloged file and belongs to a project.

Before creating a mainframe-style file, therefore, you must click Data Tools on the Options menu, check Use catalog and click OK. Then, you must open the project that is going to contain the file.

Then, to create the file, open the Catalog View. From the File menu, click New. From the New dialog box, select Data file and click OK. Mainframe Express displays the Allocate and create data set dialog box:



Figure 11-1: Allocate and Create Data Set Dialog Box

If the records are fixed length format, you specify the fixed length in Max length. If the records are variable length, you specify the maximum record length in Max length.

Once you have created the file, Mainframe Express adds its details to the catalog dynamically.

The following table shows the file types, organizations and record formats available for mainframe-style files. The table shows whether or not you have to define keys and/or specify a value under Min length, the minimum record length. The minimum record length applies to variable record formats only.

File organization (DSORG) Record format (RCFM) Define keys? Specify minimum length?
DA, DAU F, FB, FBS, FS, LSEQ, V, VB, VBS, VS No Yes if record format is one of the variable types
PS, PSU F, FB, FBS, FS, LSEQ, V, VB, VBS, VS No Yes if record format is one of the variable types
IS, ISU F, FB, FBS, FS, V, VB, VBS, VS Yes Yes if record format is one of the variable types. The minimum length must exceed the largest offset plus key length combination defined for this file.
VSAM KS Yes The minimum length must exceed the largest offset plus key length combination defined for this file.
VSAM RR No Yes
VSAM ES Optional If the file has keys, the minimum length must exceed the largest offset plus key length combination defined for this file. For files without keys it may be zero.

For definitions of these data set organization and record format codes, see the chapter Advanced Data Set Information in your IDE Technical Guide.

11.3.2 Creating PC-style Files

To create a PC-style file, you must click Data Tools on the Options menu, uncheck Use catalog and click OK.

Then, click New on the File menu. On the New dialog box, click Data File and click OK.

Mainframe Express opens the Create file dialog box:



Figure 11-2: Create File Dialog Box

If the records are fixed length format, you specify the fixed length in Max length. If the records are variable length, you specify the maximum record length in Max length.

The following table shows the PC file and record formats available. The table shows whether or not you have to define keys and/or specify a value under Min length, the minimum record length. The minimum record length applies to variable record formats only.

File format Record format Define keys? Specify minimum length?
Micro Focus Sequential Fixed, Variable No Yes if record format is variable.
Micro Focus Line Sequential Variable No No.
Micro Focus Indexed Fixed, Variable Yes Yes if record format is variable. The minimum length must exceed the largest offset plus key length combination defined for this file.
Micro Focus Relative Fixed, Variable No Yes if record format is variable.
IDXFORMAT(4) Fixed, Variable Yes Yes if record format is variable. The minimum length must exceed the largest offset plus key length combination defined for this file.

11.3.3 Defining Keys for Indexed Files

If you are creating an indexed file, the Define Keys button enables. When you click Define Keys, you can use the Key Information dialog box to enter information about keys. This information is different for mainframe-style and PC-style files.

11.3.3.1 Mainframe-style Files

When you define keys for a mainframe-style file, you must:

In addition, you can:

11.3.3.2 PC-style Files

Keys for PC-style files contain components. You specify the offsets and lengths of the components rather than of the keys. You can manipulate keys and their components too.

When you define keys for a PC file, you must:

In addition, you can:

11.4 Opening Data Files

To open a file, click Open on the File menu. For a mainframe-style file, you can also double-click the file in the Catalog View.

To open a file, Mainframe Express must be able to identify the file's type and record length. Indexed, variable-length sequential and variable-length relative files have header records that contain this information. If the file is cataloged, the information is also in the catalog. For more information about file headers, see the section File Types and Record Lengths.

When Mainframe Express opens a file, the Data File Editor window opens. For more information, see the section The Data File Editor Window.

You can open a file as read-only to prevent accidental modification of the data. For more information, see the section Switches and Warnings.


Note:


11.4.1 File Types and Record Lengths

When you open a data file, Mainframe Express uses the header information for the data file to identify the file's type and record length.

To find out a data file's header information, Mainframe Express looks first in the file header, if there is one. Then, Mainframe Express looks for a profile (.pro) file that holds the header information for the data file. If there is no profile file, Mainframe Express looks in the catalog.

If none of these sources provides the file type and record length, Mainframe Express prompts you for the file type and record length. You can find out a file's file type and record length by inspecting the source code.


Note: .pro files are supported for migration only. You cannot create .pro files using Mainframe Express.


11.4.1.1 Identifying a File Type

To identify line sequential, fixed length sequential and fixed length relative files, look under the Input-Output Section at the ORGANIZATION phrase of the SELECT statement:


Notes:


11.4.1.2 Identifying a Record Length

To find the record length, look at the record layout described by the FD entry in the File Section. The record length is the sum of all the lengths of all the elementary data items which make up the FD group item.

Each character position occupies one byte for PIC X and PIC 9 items. To find out how to calculate the length of computational fields (COMP-1, COMP-2, COMP-3, COMP-4, COMP-5 and COMP-X), consult the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, click Reference, COBOL Language Reference, Concepts of the COBOL Language, Selection of Character Representation and Radix, Overview - Selection of Character Representation and Radix.

11.5 The Data File Editor Window

The Data File Editor window opens when you create a new data file or open an existing data file.

The Data File Editor window is split into two panes:



Figure 11-3: Data File Editor Window

11.5.1 Record View (Unformatted View)

The left-hand pane shows unformatted record data, with one record per line. When you scroll left or right along a record, your view of all records on the screen scrolls at the same time.

You can select a record by either clicking a field or using + and -. The currently selected record is highlighted.

When the focus is on this pane, the status bar at the foot of the Mainframe Express window shows the following information, from left to right (see Figure 11-4):

Ushort descr

Figure 11-4: Relative File Record View and Status Bar

11.5.2 Field View (Formatted View)

The right-hand pane shows formatted data at field level one record at a time. Each field is shown on a separate line. You can edit the contents of each field in the Value column.

To view and edit your data at field level, you need to create a record layout file. For further information, see the chapter Using Record Layouts with Data Files.

Use this view to display data at field level and to edit the contents of a field:

To move between records, use the small up and down arrow buttons on the top right-hand pane of the field view window or select a new record in the record view pane.

When the field view pane is selected, the status bar at the foot of the Mainframe Express window shows the following information, from left to right (see Figure 11-5):

Ushort descr

Figure 11-5: Relative File Field View and Status Bar

11.5.3 Keeping the Two Views in Step

With both views displayed, you can use either of the two methods below to keep the two views in step:

11.6 Creating Records

The methods for creating records are different for sequential, relative and indexed files: sequential files do not have keys; relative and indexed files have different types of keys. Special considerations apply to VSAM ES files.

If you have a record layout file loaded, you can choose to base a new record on one of the record layout types or have the new record filled with padding bytes. For more information, see the chapter Using Record Layouts with Data Files. If you have created conditional record layouts and you choose your new record to be one of these, the condition field is set appropriately. To add a new conditional record layout, however, you must recreate the record layout file.

11.6.1 Sequential Files

You can insert a new record either before or after the currently selected record.

You can also create new records by:

11.6.2 Relative Files

When you create a new record in a relative file, you have to provide a relative record number so that Data File Editor can position the new record in the file.

You can create a new record or copy an existing record.


Note: When you create a new relative record, the line number displayed in the status bar is reset to zero (see the section Viewing Non-sequential Files).


If you have not loaded any record layouts, Data File Editor uses the appropriate padding byte and sets the record to:

11.6.3 Indexed Files

You can create a new record or copy an existing record.

Whenever you create or copy an indexed file record, you specify all unique keys for the new record. The prime key should always be a unique key. In some cases, a file might also have one or more unique alternate keys.

If you are inserting records with record layouts loaded, any key information that you specify during the insert process takes precedence over conditional data associated with the selected record layout. For more information about record layouts, see the chapter Using Record Layouts with Data Files.


Note: When you create a new indexed record, the line number displayed in the status bar is reset to zero. See the section Viewing Non-sequential Files for more details.


11.6.4 Creating VSAM ES File Records

You can only create a new record in a VSAM ES file (often known as ESDS files) by appending an empty record to the end of the file. If the file has alternate indexes, you must also supply any unique key values.

The new record is always positioned physically at the end of the file. If the file has alternate indexes, the empty record appears in the editing window in the position in the file dictated by the key of reference. For more details, see the section Viewing Non-sequential Files.

Once the record has been appended, you specify the field values in an editing session.

11.7 Deleting Records

You can delete single or multiple records from any type of data file except for VSAM ES files.

The multiple delete procedure runs even if insufficient records are available. The delete continues until the end of the file when a message box displays the number of records deleted.


Note: You should ensure that Delete warning on the Data Tools check box is selected. For more details, see the section Switches and Warnings.


11.8 Viewing Data

You can view the records in data files. For further details on this view, see the section Record View (Unformatted View).

If you have loaded a record layout, you can also view the fields used by your application. For further details on this view, see the section Field View (Formatted View).

11.8.1 Viewing File Information

You can look up the current Data file Editor settings for a file, as well as view mainframe-style and PC-style file details.

To look up this information, click Data Tools>File Information on the View menu. Alternatively, right-click in the Data File Editor window and click File Information on the popup menu.

11.8.2 Changing Character Sets

Data File Editor displays all data as either ANSI or EBCDIC. You can alternate between these character sets using the Data File Toolbar (see Figure 11-6). This toolbar shows you which character set and selected key are currently in use.

To display the Data File Toolbar, click Dockable Windows from the View menu, check the Data File Toolbar and click OK.



Figure 11-6: Data File Toolbar

You can tell if your file is being displayed in the wrong format by looking for spaces in display format information. If you display an EBCDIC format file in ANSI, spaces (EBCDIC code h"40") appear as "@". If you display an ANSI file in EBCDIC, spaces (ANSI code h"20") appear as non-alphanumeric characters - the exact character depends on the operating system character set.

11.8.3 Changing the Key of Reference for Viewing Indexed Files

By default, Data File Editor displays records in an indexed file in primary key order. If the file has alternate keys, you can change the display order by selecting a different key of reference. To select an alternate key for viewing an indexed file, use the Data File Toolbar (see Figure 11-6). This shows the currently selected key and character set.

11.8.4 Viewing Non-sequential Files

You can alter your position in a file by:

When you change your position in a file in one of these ways, the line number that you see in the status bar at the foot of the Mainframe Express window will be reset to zero. This is because line numbers in these types of files can only be determined with respect to some given position.

The line number then changes as you move through the file:

To maintain consistency with the line number, the column number also starts from zero.

11.9 Editing Data

You can:


Notes:


11.9.1 Searching for Data

There are several ways of moving to a particular record for editing:

In addition, if a record layout is associated with the data file, you can jump directly to a field within a record. See the section Searching a File for more details.

11.9.2 Editing Records

You can edit data in record view by overtyping, inserting or deleting data. To find out more about record view, see the section Record View (Unformatted View).

When you insert or delete data in record view, you can create a shift in all of your data. Therefore, to avoid corrupting the fields following the insert or delete, check Always overtype in unformatted view on the Data Tools checkbox.

If Update warning is selected, you see an Update warning message box.

For more information about these settings, see the section Switches and Warnings.

11.9.3 Editing Fields

You can edit alphanumeric or numeric data directly in any field.

Modes enabled for editing are:

If Update warning is checked, you see an Update warning message box. For more information, see the section Switches and Warnings.


Notes:


11.9.4 Initializing Data

You can initialize a single field or all the fields in a record.

If you have created any conditional record layouts, the field used for testing the condition remains unaffected by initializing a record. (For information about conditional record layouts, see the section Types of Record Layout in the chapter Using Record Layouts with Data Files.)

If the file is indexed, the keys for a record remain unaffected by initializing a record.

11.9.5 Changing the Length of a Record in a Variable Length File

You can change the length of a record in a variable length file. If you reduce the length of a record, the record is truncated to the new length. If you increase the length of a record, the extra bytes are filled with the current padding byte.

11.10 Working in Hexadecimal

This section describes how to view and edit in hexadecimal.

11.10.1 Viewing in Hexadecimal

You can display your ANSI or EBCDIC data in hexadecimal by clicking Data Tools>Show Hex on the View menu. The hexadecimal value of each byte is displayed in a window below the main edit window. For both record and field level displays, each character has its hexadecimal representation on the two lines below.

Figure 11-7 shows a file with hexadecimal display.

11.10.2 Editing in Hexadecimal

If you have hexadecimal values displayed, you can edit them directly. This enables you to type invalid data into your files for testing purposes.

To display your ANSI or EBCDIC data in hexadecimal, click Data Tools>Show Hex on the View menu.

The hexadecimal value of each byte is displayed in a window below the main edit window. Each character has its hexadecimal representation on the two lines below it for both record and field level displays. You can edit both the character and the individual hexadecimal values.

Figure 11-7 shows a file with hexadecimal display.



Figure 11-7: File with Hexadecimal Display

11.11 Searching a File

The Data Tools option on the Search menu offers the following types of search:

If you have a record layout file loaded or associated with this file, you see the results of your search highlighted in the right-hand pane of the edit window. For more details, see the chapter Using Record Layouts with Data Files.

When you use any type of search, Data File Editor selects the first record it finds in your chosen search direction which matches your search criteria.

If there are no matches, the message "Could not find search string after the current edit position" is displayed.


Note: When you are searching on a numeric key with COMPUTATIONAL usage, you must specify the hexadecimal value. Data File Editor does not format data specified in the Find on Key dialog box, even where a record layout file exists. This is because a key can be split across several fields which might each have different formatting.


11.12 Printing Data

You can print your data file records either unformatted or formatted. You can also preview the data.

If you have not loaded a record layout file, you can only print or preview your data in the unformatted view. For more details, see the chapter Using Record Layouts with Data Files.

11.12.1 Unformatted View

If you are printing or previewing from the unformatted view, you can print:

If you are previewing records, you can change the magnification of the display.


Notes:


11.12.2 Formatted View

Printing or previewing from the formatted view is the same as for the unformatted view except:


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

PreviousOverview of Working with Data Files Converting Data FilesNext"