PreviousFile Conversion Utilities

Chapter 12: GUI Data Tools

This chapter describes the facilities NetExpress  provides to help you create and maintain your application's data files on your PC.

12.1 Introduction

NetExpress offers the following GUI data tools to help you create, maintain and convert data files:

For an introduction to using these Data Tools, we recommend you work through the chapter Maintaining and Creating Data Files in your Getting Started.

For detailed information about using the facilities described in this chapter, see the help provided in the NetExpress online help file. (Click on the Help Topics button, ensure that the Contents tab is at the front and then select Development Environment, Data Tools.)

12.2 Types of Data Files

12.2.1 File Types and Record Lengths

When you open a file, NetExpress  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.

Line sequential, fixed length sequential and fixed length relative files do not have file headers. To save you having to enter the file type and record length each time you open the file, you can save this information in a profile file in the same directory as the data file. The profile file has the same filename as the data file and a .pro extension.

When you open a line sequential, fixed length sequential or fixed length relative file, NetExpress  looks in the same directory for a .pro file with the same filename as the datafile. If there is no .pro file, NetExpress 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. After you have entered these file header details, Net Express prompts you to save the details to a profile file.

12.2.1.1 Identifying a File Type

To identify line sequential, fixed length sequential and fixed length relative files you need to look in the Input-Output Section, at the ORGANIZATION phrase of the SELECT statement.


Notes:


12.2.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 topic Overview - Selection of Character Representation and Radix in the COBOL Language Reference section of the online help for more details.

12.3 Data Tools Settings

You can modify the behavior of the Data Tools by changing the Data Tools settings. These settings take effect until the next time you change them. To change or view the settings, select Data Tools from the Options menu.

Many of these settings are concerned with protecting you from the results of inadvertently changing or deleting your data. The settings are as follows:

12.3.1 Configuring Codesets

Using the Codecomp utility, you can create customized mapping tables for EBCDIC/ANSI character set translation. NetExpress has built-in support for a number of character sets. For more information, see the help provided in the NetExpress online help file. (Click on the Help Topics button, ensure that the Contents tab is at the front and then select Development Environment, Data Tools, Configurable Codesets.)

12.4 Creating and Opening Data Files

You can use Data File Editor to create data files.

If you create indexed files, you will need to define their keys (see the section Defining Keys).

Once your files exist, you can open a file for editing.

To create a data file, select New on the File menu then Data File in the New dialog box. The Create file dialog box is shown.


Figure 12-1: Create File Dialog Box

Use Maximum length according to the format of the records as shown below:

The following table shows:

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.

12.4.1 Defining Keys

If you are creating an indexed file, the Define Keys button in the Create File dialog box or Data File Convert dialog box becomes enabled. When you click Define Keys, you see the Key Information dialog box.

Keys for data files contain components, and you specify the offsets and lengths of the components rather than of the keys. You can manipulate both keys and components of keys.

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

In addition, you can:

12.4.2 Opening Files

When you open a sequential file, Data File Editor loads the file into memory where you modify the data. The data file isn't updated on disk until you close the file and you see a message asking if you want the changes that you have made to be applied.

When you open an indexed or relative file, the file isn't loaded into memory because these types of files can be very large. When you modify data in one of these file types, then move off the record, Data File Editor updates the record on disk and displays a message to that effect.

The Data File Editor gives you the option of opening a file as read-only to prevent accidental modification of the data (see the section Data Tools Settings).

You can open a file using Open on the File menu. When you open a file the Data File Editor Window is displayed.


Note: You can't open a file if the backup option is selected and there isn't enough disk space for the backup file (see the section Data Tools Settings).


12.5 The Data File Editor Window

The Data File Editor window is split into two panes:

Both these views are described in more detail below.


Figure 12-2: Data File Editor Window

12.5.1 Record View (Unformatted View)

You can select a record by clicking on the field or using the up and down arrow keys. The currently selected record is highlighted.

When the focus is on this pane, the status bar at the foot of the NetExpress window shows the following information, going from left to right (see Figure 12-3):

Ushort descr
Figure 12-3: Relative File Record View and Status Bar

12.5.2 Field View (Formatted View)

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 NetExpress window shows the following information, going from left to right (see Figure 12-4):

Ushort descr
Figure 12-4: Relative File Field View and Status Bar

12.5.3 Keeping the Two Views in Step

If you have both views displayed you can use two methods of keeping the two views in step:

If you have positioned the cursor in a field or record, you can use Synchronize Views to force the cursor to the same position in the other pane. You can find this option either by clicking DataTools on the View menu or right-clicking in the Data File Editor window.

If you have updated data in the unformatted view, you can see the effect of the changes in the formatted view by using Refresh Formatted Pane. You can find this option by clicking DataTools on the View menu.

12.6 Creating Records

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

If you have a record layout file loaded, you can choose to base a new record on one of the existing record layout types or have the new record filled with padding bytes. (See the section Record Layouts.) 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.

12.6.1 Creating Sequential File Records

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

You can also create new records by:

12.6.2 Creating Relative File Records

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 no record layouts are loaded, the appropriate padding byte is used and the record is set to:

12.6.3 Creating Indexed File Records

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 entered during the insert process takes precedence over conditional data associated with the selected record layout (see the section Record Layouts).


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).


12.6.4 Creating ESDS File Records

You can only create a new record in a ESDS file 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 physically positioned at the end of the file, but 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 (see the section Viewing Non-sequential Files).

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

12.7 Deleting Records

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

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


Note: You should ensure that the Delete warning check box is selected. For further details see the section Data Tools Settings.


12.8 Viewing Data

You can view your data files in two ways:

Data File Editor can display your ANSI or EBCDIC data in hexadecimal. 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.

Figure 12-6 shows a file with hexadecimal display.

12.8.1 Viewing File Information

You can use the File Information dialog box to check on the current Data file Editor settings as well as the file details. To open the File Information dialog box, select Data Tools from the View menu and then select File Information.

12.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 12-5). This toolbar shows you which character set and selected key are currently in use.

To display the Data File Toolbar, select Dockable Windows from the View menu and then select the Data File Toolbar checkbox.


Figure 12-5: 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.

12.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 12-5). This shows the currently selected key and character set.

12.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 (record number) that you see in the status bar at the foot of the NetExpress window starts from zero. The column number also starts from zero for consistency with the line number.

If you then move backward in the file, the line number decreases by one for each record moved and appears as a negative number.

If you move forward in the file, the line number increases by one for each record moved.

12.9 Editing Data

Net Express enables you to:


Notes:

  1. If you make a mistake editing a file you can restore it from a backup by closing the editing window and copying the backup file over your edited file using a file manipulation tool such as Explorer. If the file is indexed, you must also copy the .ibk file to make sure that the index and data keep in step.

  2. When you select a record, Data File Editor saves the data. You can restore this data at any point until you select a new record.

12.9.1 Finding Data

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

12.9.2 Editing Records

You can edit data in record view by overtyping, inserting or deleting data.

When you insert or delete data in record view, you can create a shift in all of your data, corrupting the fields following the insert or delete. You can avoid this by setting Overtype Mode.

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

For more information about these settings see the section Data Tools Settings.

12.9.3 Editing Fields

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

Modes allowed for editing are:

If Update warning is selected you see an Update warning message (see the section Data Tools Settings).


Notes:


12.9.4 Editing in Hexadecimal

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

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 12-6 shows a file with hexadecimal display.


Figure 12-6: File with Hexadecimal Display

12.9.5 Initializing Data

You can reset a whole field to spaces or zeros by initializing it. You can also initialize all the fields in a record. An alphanumeric field is initialized to spaces, a numeric field to zeros.

If you have created any conditional record layouts (see the section Types of Record Layout), the field used for testing the condition remains unaffected by initializing a record.

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

12.9.6 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, while if you increase the length of a record, the extra bytes are filled with the current padding byte.

12.10 Searching a File

Data File Editor 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 (see the section Record Layouts).

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, you see a message "Could not find search string after the current edit position".


Note: When you are searching on a numeric key with COMPUTATIONAL usage, you must enter the hexadecimal value. Data File Editor does not format data entered 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.


12.11 Printing Data

You can print your data file records either unformatted or formatted. You can also preview the data before printing it. If you haven't loaded a record layout file, you can only print or preview your data in the unformatted view (see the section Record Layouts for further details).

12.11.1 Printing from the Unformatted View

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

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


Notes:


12.11.2 Printing from the Formatted View

The facilities for previewing or printing data from the formatted view are the same as for the unformatted view except for the following differences:

12.12 Record Layouts

This section gives you background information about record layouts. To find out how to create a record layout and associate the record layout with a data file, see the help provided in the NetExpress online help file. (Click on the Help Topics button, ensure that the Contents tab is at the front and then select Development Environment, Data Tools, Record Layout Editor.)

For more help, refer to the chapter Maintaining and Creating Data Files in your Getting Started. This chapter contains a tutorial, part of which takes you through the process of creating a record layout file.

A record layout is a representation of the structure of a data record. If you have a record layout available for a data file, browse and edit the data file at the individual field level within a record and see the numeric values of data held in non-display fields. COBOL programs contain record layouts. An example of a COBOL record layout is:

01 REC.
   02 EMP-CODE.
      03 EMP-POSITION        PIC X.
      03 EMP-NUM             PIC 9(6).
   02 EMP-AGE                PIC 99 COMP.
  02 EMP-YEARS-WITH-COMPANY  PIC 99 COMP.

In this example EMP-AGE and EMP-YEARS-WITH-COMPANY are numeric non-display fields.

You use the Record Layout Editor to create a record layout (.str) file that contains one or more record layouts for your data. A record layout file contains information describing the records in your data file, the name, length and picture of each field. If your data file includes multiple types of records, you can capture these multiple record layouts in one record layout file.

Once you have created the record layout file for a particular data file, you can keep it and use it whenever you want to work with that data file. You only need to recreate the record layout file if you either change the record layout in your COBOL program or wish to add a new conditional record layout.

The Record Layout Editor uses the debug information (.idy) file from your compiled COBOL program to create a record layout file. Without an associated .idy file you cannot create a record layout file. You create an .idy by compiling your program for debug. If your COBOL record layout contains FILLER items, you must compile with the INCLUDE-FILLER Compiler directive, in order for the record layout file to include the FILLERs. (For more details on compiling for debugging, see the topic Development Environment in the online help.)

Record layout files are also used by the Data File Converter (see the section Converting Data Files).


Note: If your data file has a very simple record format, you may not wish to create a record layout file for your data's formatted view.


12.12.1 Types of Record Layout

There are two types of record layout:

12.12.2 Using Record Layouts

Loading or associating a record layout file with your data file enables you to see your record data formatted at field level in the right-hand pane of Data File Editor's window (see the section Data File Editor Window).

If a record is found which doesn't match any of the available layouts or contains an invalid OCCURS DEPENDING ON RANGE, you see a warning message in the field view pane and status bar.

You must save the record layout file in the same directory as the data file and use the same basename.

12.13 Converting Data Files

You can convert data files between file organizations and formats using the Data File Converter.

Converting files from one format to another enables you to restructure data. For example, you can convert from sequential organization to indexed, or add extra secondary indices as the needs of an application change.

The Data File Converter also provides an easy method for data conversion between EBCDIC and ANSI, and removes the need for you to recreate data already produced or to write special conversion programs. If records contain non-text data items, such as COMPUTATIONAL data, you can use record layouts to define the data items to be converted and those data items that should remain unconverted. For more information on how to create a record layout file, see the section Record Layouts.

The Data File Converter can also convert internal floating-point formats between S/370 format and IEEE format using the record layout descriptions.

You can increase or decrease the minimum and maximum record length for the new file:


Note: If you request a conversion of a sequential file to an indexed file with unique keys, and some of the records contain duplicate key values, Data File Converter ignores these records and does not convert them. At the end of the conversion Data File Converter informs you of the number of records rejected.


You can use the file conversion to convert:

A mainframe file should be transferred to the PC in binary format. If this file is initially a variable-length file, you can ask your administrator to use the mainframe program VRECGEN to perform an initial reformat of the file on the mainframe. You can then process the file using Data File Converter. When you want to upload the file to the mainframe, you should use Data File Converter to convert it to VRECGEN2 format, then ask your adminstrator to use the mainframe program VRECGEN2 to reformat the data for the mainframe.

You may need to convert report files that have either been produced on the mainframe then downloaded to the PC or created by a mainframe application run on the PC. A mainframe report file contains carriage control characters which the Data File Converter converts to PC-printable formats. When the output file is the mainframe file, the record length includes the carriage control character. When the output file is the PC print file, the record length is solely the data length.

If you specify the input file as a mainframe print format file, but it was created on the PC you may receive error message 139, Input file not "real" mainframe report format. You can prevent this by ensuring that normal mainframe dialects are used to create an EBCDIC report file.

Mainframe report files can only be converted to PC print files. Similarly a PC print file can only be converted to a mainframe report file. The mainframe report file should be an EBCDIC-encoded file and the PC print file should be ANSI-encoded.

When you enter the input filename, the Data File Converter uses the process outlined in section File Types and Record Lengths to read the input file details. You need to specify the output file's name and you can change the default organization and record format values picked up by the Data File Converter. If no file details are available, you need to enter them.

If you have selected the output file to have indexed organization, you need to define the keys for the new file (see the section Defining Keys).

For more information about using VRECGEN, VRECGEN2 and the command line interface, see the File Conversion Utilities chapter.

12.14 Fix File Index

Use Fix File Index to rebuild the index of a corrupt indexed file. For more information, see the section Fix File Index in the Rebuild chapter.


Copyright © 1998 Micro Focus Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.
PreviousFile Conversion Utilities