This chapter describes the Record Layout Editor that you can use to provide formatting for data file records. You can then use the Data File Editor to view and edit the data in your data files. In particular, you can see the numeric values of data. For more information on using the Data File Editor to edit data files, see the chapter Editing Data Files.
For detailed instructions on using the Record Layout Editor, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, double-click Development Environment, Working with Data Files, Working with Record Layouts.)
When you first load a data file into the Data File Editor, the data in the right-hand pane is not formatted for you to view or edit. To enable you to view and edit formatted data, you can use the Record Layout Editor to create one or more layouts for the records in the data file.
To create a record layout, the Record Layout Editor extracts the data layout from the Data Division of a debug information (.idy) file. (You produce this file by compiling a COBOL source (.cbl) file for debug within the project.) The record layout that you create describes the name, length and picture of each field in a data record.
You can create more than one record layout for the records in a data file by setting up conditions on test fields. The Data File Editor uses the test fields to work out which layout to use for which record.
When you create record layouts for a data file for the first time, you save the record layouts in a record layout (.str) file. You can add more layouts later on by editing the .str file. You can also open the .str file and delete record layouts that you no longer require.
Record layout files are also used by the Data File Converter to control which fields in a record are converted when converting between EBCDIC and ANSI.
There are two types of record layout:
You can define one default record layout for each data file. A default record layout formats data that does not meet the conditions specified by any conditional record layouts that you create for the data file.
As well as a default record layout, a data file can have one or more conditional record layouts. When you create a conditional record layout, you define a test that applies to one or more fields. To use a conditional record layout, the data in a record must satisfy all the tests defined for that layout.
If you do not define any conditional record layouts, all the records in the data file adopt the default record layout if you have set one up.
When you modify data in a record, the Data File Editor works out automatically which record layout to use for the modified record.
To create record layouts for a data file for the first time, the Record Layout Editor requires the following information:
You select a COBOL source (.cbl) file for your COBOL program. The Record Layout Editor loads the Data Division from the corresponding Debug Information (.idy) file.
You create an .idy file by compiling your program for debug.
You can create one default record layout and as many conditional record layouts as you require.
In addition, for conditional record layouts only, you need to select the test field(s) and specify the test condition(s). For more information, see the section Setting up a Test Condition.
A record layout name is the same as the layout name taken from the Data Division, except that default record layout names are appended by the word "DEFAULT". For example, if you extract a layout named CUSTOMER-REC from the Data Division, this translates as CUSTOMER-REC-DEFAULT for a default record layout and as CUSTOMER-REC for a conditional record layout.
The first time you create record layouts for a data file, you go into the Files View of the Project View. You compile the COBOL file that contains the Data Division you want to use, making sure that the Create debug information field is selected in the Build Settings for COBOL. This ensures that you create the Debug Information (.idy) file from which the Record Layout Editor extracts the Data Division. Next, you right-click on the COBOL file in the right-hand pane and select Create Record Layout.
Once you have saved record layouts for a data file in a record layout (.str) file, you can open the record layout file and go into the Record Layout Editor directly.
The Record Layout Editor has one main window:
Figure 12-1: The Record Layout Editor Window
The Record Layout Editor window divides into two parts:
Tip: If you are editing a record layout (.str) file, a Data Division does not load automatically. You can load a Data Division in the left-hand pane by right-clicking in the Record Layout Editor window and clicking Load Data Division on the popup menu.
The left-hand pane displays the Data Division that you load from the debug information (.idy) file associated with your chosen COBOL source (.cbl) file.
The areas on the left-hand pane of the Record Layout Editor window are described below, from the top down:
Figure 12-2: The COBOL Header Bar
The COBOL Header Bar displays the name of the COBOL program from which the Data Division is taken.
Figure 12-3: The Data Division View
The Data Division View Displays the Data Division of the selected COBOL program.
The areas on the right-hand pane of the Record Layout Editor window are described below, from the top down:
Figure 12-4: The Header Information Bar
The Header Information Bar gives information about the status of the record layout file and is made up of the:
Icon |
Indicating |
---|---|
![]() |
The record layout file contains record layouts and there are no problems. |
![]() |
There are no record layouts loaded. Consequently, the Record Layout View is empty. |
![]() |
A conditional record layout does not have a test field. |
You can toggle the Header Information Bar on and off.
Figure 12-5: The Record Layout View
The Record Layout View lists the record layouts currently defined.
Layout Icon |
Indicating |
---|---|
![]() |
A default record layout |
![]() |
A conditional record layout |
![]() |
A field that is part of the layout |
![]() |
A test field in a conditional record layout |
To expand a record layout or group item, click .
To compress a record layout or group item, click
.
To highlight a layout or field, click on the layout or field. The Header Information Bar updates to display the number of conditions, if any, set up for the highlighted layout.
Tips:
Click on the layout in the Record Layout View and hold the cursor
over the icon in the
Header Information Bar.
Hold the cursor over the
icon next to the record layout in the Record Layout View.
Hold the cursor over the
icon next to the test field in the record layout in the Record Layout
View.
For each conditional record layout, you must specify one or more conditions that a record must fulfil to adopt that layout. Each condition is related to a test field. You use the Field Properties dialog box to specify a condition:
Figure 12-6: Conditions Offered by the Field Properties Dialog Box
From the Record Layout Editor window, you can open the Field Properties dialog box by right-clicking on a field and selecting Properties.
When you select a condition, either one or both of the value boxes to the right becomes available. For example, the condition IS = TO only requires you to enter one value, whereas the condition IS BETWEEN requires you to enter two values.
The Record Layout Editor window displays
against each test field.
For full instructions on how to create a conditional record layout, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, double-click Development Environment, Working with Record Layouts, Creating and Removing Record Layouts.)
The Field Properties dialog box (see Figure 12-6 in the section Setting up a Test Condition) has a Convert checkbox that controls whether the field is converted during an EBCDIC to ANSI conversion or an ANSI to EBCDIC conversion. By default, Convert is switched on except in the following cases when it is switched off:
You can change the Convert setting for any field in a record layout by right-clicking the field and clicking Properties on the popup menu.
Warning: If you switch the Convert field back on for a field that is redefined, remember to switch it off for that field when it is first defined.
To find out more about the Data File Converter, see the chapter Converting Data Files.
You should store all the record layouts for one data file in a record layout (.str) file.
Before exiting from the Record Layout Editor, you should save the record layout information in a record layout (.str) file.
Because you are using a catalog for your data files, you can:
Since PC-style files are not catalogued, the location and name of the record layout file is crucial. When the Data File Editor opens a data file, the editor looks for a record layout file in the same directory as the data file and with the same basename.
To ensure that record layouts load automatically each time you open the data file, follow the guidelines below when you save the record layout file:
Record Layout File |
Guideline |
---|---|
File basename | The same file basename as the data file. |
File extension | .str. |
Folder | The same folder as the data file. |
For example, if the data file is named customers.dat and is located in the c:\data folder, you should save the record layout file as c:\data\customers.str.
You can open the record layout file (.str) at any time, as long as you have the data file closed. The Record Layout Editor window opens and displays the record layouts you have already created. You can:
When you load a record layout file with your data file, you can see your record data formatted at field level in the right-hand pane of Data File Editor's window. To view a sample, see the section Data File Editor Window in the chapter Editing Data Files.
To retrieve record layouts:
If you are working with PC-style files, the record layout file should load automatically with the data file. For more information, see the section Saving Record Layouts for PC-style Files.
Otherwise, you can load the record layout file separately by selecting the Data Tools > Load Record Layouts option on the File menu.
Copyright © 2001 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.