Editing IMS Databases | SQL Option for DB2 |
This chapter describes the Segment Layout Editor that you can use to provide formatting for the data in IMS segment occurrences. You can then use the IMS Database Editor to view and edit the IMS segment occurrences. For more information on using the IMS Database Editor to edit IMS databases, see the chapter Editing IMS Databases.
For detailed instructions on using the Segment Layout Editor, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, double-click IMS Option, Working with IMS Databases, Working with Segment Layouts.)
When you first load an IMS database into the IMS Database 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 IMS data, you use the Segment Layout Editor. Each time you create a segment layout, the Segment Layout Editor:
You produce this file by compiling a COBOL source (.cbl) file for debug within the project.
When you open that database in the IMS Database Editor, the editor can apply formatting to segment occurrence data within that segment type.
The layout that you create is referred to as a segment layout. The layout describes the name, length and picture of each field in the segment. You can create more than one segment layout for a segment type by setting up conditions on test fields. The IMS Database Editor uses the test fields to work out which layout to use for which segment occurrence.
When you create segment layouts for an IMS database for the first time, you save the segment layouts in a segment layout (.slf) file. You can add more layouts later on by editing the .slf file. You can also open the .slf file and delete segment layouts that you no longer require.
There are two types of segment layout:
You can define one default segment layout for each segment type. A default segment layout formats data that does not meet the conditions specified by any conditional segment layouts you have created for that segment type.
As well as a default segment layout, each segment can have one or more conditional segment layouts. When you create a conditional segment layout, you define a test that applies to one or more fields. To use a conditional segment layout, the data in a segment occurrence must satisfy all the tests defined for that layout.
When you initialize a segment occurrence, you can choose to specify the segment layout that you want to use to enter data.
When you modify data, the IMS Database Editor works out automatically which layouts to use for which occurrences.
To create segment layouts for an IMS database for the first time, the Segment Layout Editor requires two pieces of information:
You select a COBOL source (.cbl) file for your COBOL program. The Segment Layout Editor loads the Data Division from the corresponding debug information (.idy) file.
You create an .idy file by compiling your program for debug. If your COBOL layout contains FILLER items, you must compile with the INCLUDE-FILLER Compiler directive, since the segment layout file must include the FILLER items. For more details on the INCLUDE-FILLER Compiler directive, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, double-click Reference, Development Environment, Compiler Directives.)
Then, for each segment layout that you want to create, you have to:
In addition, for conditional segment 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.
Warning: Make sure that the setting Create debug information is checked. If it is not checked, then the Build does not produce a debug information (.idy) file. To access this setting, click Build Settings for Project on the Project menu and click the COBOL tab.
Within the Segment Layout Editor, the layout-name is made up of two parts, separated by a hyphen (-). Depending upon whether the segment layout is a default or conditional segment layout, the layout-name is constructed as follows:
segment-DEFAULT
where segment is the name of the segment type in the IMS database. For example, the default segment layout for a segment type named LD9S1 would be LD9S1-DEFAULT.
In the IMS Database Editor, the Layout Status Bar displays the name of a default segment layout simply as DEFAULT.
segment-layout
where:
segment | is the name of the segment type in the IMS database |
layout | is the name of the COBOL layout used to create the segment layout |
For example, a COBOL layout named 01 CUSTREC applied to a segment type named LD9S1 would result in the layout-name LD9S1-CUSTREC.
In the IMS Database Editor, the Layout Status Bar displays only the second part of the layout-name. Therefore, for LD9S1-CUSTREC, simply CUSTREC is displayed.
The Segment Layout Editor has one main window:
Figure 37-1: The Segment Layout Editor Window
The Segment Layout Editor divides into parts:
Tip: If you have just opened a segment layout (.slf) file, you can load a Data Division in the left-hand pane by right-clicking in the Segment 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 Segment Layout Editor window are described below, from the top down:
Area Name |
Description |
---|---|
The COBOL Header Bar displays the name of the COBOL program from which the Data Division is taken. |
|
The Data Division View Displays the Data Division of the selected COBOL program. |
Note: To open a Data Division in the left-hand pane, make sure that the DBD displayed in the Header Information Bar is in an IMS project that is currently open and is present in the IMS View.
The areas on the right-hand pane of the Segment Layout Editor window are described below, from the top down:
For each conditional segment layout, you must specify one or more conditions that a segment occurrence 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 37-6: Conditions Offered by the Field Properties Dialog
Box
From the Segment 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 Segment Layout Editor window displays against each test field.
For full instructions on how to create a conditional segment layout, see the Mainframe Express online help. (Click Help Topics on the Help menu. Then, on the Contents tab, double-click IMS Option, Working with IMS Databases, Working with Segment Layouts, Creating and Removing Segment Layouts.)
Before exiting from the Segment Layout Editor, you should save the segment layout information in a segment layout (.slf) file.
The default settings for the segment layout file are:
Segment Layout File |
Default Setting |
---|---|
File basename | The same name as the IMS database name |
File extension | .slf |
Folder | The DATA folder of the project folder for the IMS database |
As long as you retain these default settings, the IMS Database Editor loads the segment layout file automatically when you open the database. Otherwise, you can load the segment layout file separately.
The next time that you want to create segment layouts for the database or make changes to the segment layouts you already have, simply open the segment layout (.slf) file that you have saved for the database. The Segment Layout Editor window opens and displays the segment layouts you have already created.
This section lists the questions that you or other users may ask.
A. There are two circumstances under which the Segment Layout Editor displays this particular message:
You should close the IMS database before attempting to load a Data Division into the Segment Layout Editor.
You should open the project before attempting to load the Data Division. Otherwise, the Segment Layout Editor cannot locate the debug information (.idy) file from which it extracts the Data Division.
Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Editing IMS Databases | SQL Option for DB2 |