The IMS demonstration database used in this tutorial contains data for which you create segment layouts using the Segment Layout Editor. Data formatted in the segments created here are then viewed and edited in the Tutorial: IMS Database Editor topic.
This tutorial uses the same project used in Tutorial: IMS Support. If you have already completed Tutorial: IMS Support, nothing further is required. However, if you have not completed Tutorial: IMS Support, complete all steps included in the Create and Configure a Project topic, and all steps in the Load the Database section of the Configure IMS topic before proceeding.
You can define one default segment layout for each segment type. You can also define one or more conditional segment layouts for the same segment type. The IMS Database Editor uses the default segment layout to format data for those segment occurrences that do not match any of the conditional segment layouts.
The Segment Layout Editor extracts the COBOL layout information from the selected COBOL file's corresponding debug information (.idy) file.
The New IMS Layout dialog box opens and displays a list of IMS databases. Here, you select the IMS database for which you want to create segment layouts.
The Segment Layout Editor opens. The left pane of the Segment Layout Editor window displays the Data Division of demo00I1.idy. The right pane is empty because, as yet, you have no segment layouts defined.
In the next step, you select the DEMOHDRS COBOL layout and apply it to the DEMOHDRS segment type in the DEMO03DD database. Here, the layout and the segment type share the same name (DEMOHDRS), but the two names can be different.
This action invokes the New Segment Layout Wizard where you can create a default segment layout for DEMOHDRS based on the 01 DEMOHDRS COBOL layout that you have just dropped into the right pane.
The wizard adds the layout you have just defined for DEMOHDRS to the right pane of the window. As this is the default layout for the segment type DEMOHDRS, the word "DEFAULT" is appended to the segment-name DEMOHDRS.
The COBOL layout starts to expand.
In this section, you view the new DEMOHDRS-DEFAULT segment layout in the IMS DB Editor. Because you have defined this segment layout, when you open the IMS Database Editor, the DEMOHDRS-DEFAULT layout loads automatically and the data for the DEMOHDRS segment is formatted. This means that from this point on, you can view and edit formatted data in DEMOHDRS segment occurrences.
This starts the IMS Database Editor, showing formatted data for the DEMOHDRS segment in the right pane. The key fields are highlighted in red.
Because you have not yet defined a segment layout for DEMOELES, the Field Layout View in the right pane empties. The next thing to do, therefore, is to return to the Segment Layout Editor and define a default layout for the DEMOELES segment.
To create a default segment layout for DEMOELES, you edit the DEMO03DD.SLF segment layout file and add a second segment layout to it.
The wizard adds the layout you have just defined for DEMOELES to the right pane of the window. As this is the default layout for the segment type DEMOELES, the word "DEFAULT" is appended to the segment-name DEMOELES.
So far, you have created a default segment layout for each of the segment types DEMOHDRS and DEMOELES. You can create additional segment layouts for these segment types and specify the conditions under which those layouts should be used. These other layouts are referred to as conditional segment layouts.
You are going to create a conditional segment layout with a test field for the DEMOELES segment type. The test field determines which DEMOELES segment occurrences use the conditional layout rather than the default layout.
The demo Data Division has only one layout that is suitable for formatting data for DEMOELES segment occurrences. For the purposes of demonstrating conditional segment layouts only, you use this layout again to create a conditional layout for DEMOELES.
The Segment Layout Editor window now includes the new conditional segment layout for DEMOELES in the right pane.
As this is not a default layout, the name of the layout is appended by the name of the layout in the COBOL source file. The segment type in the IMS database and the COBOL source layout share the same name which is DEMOELES. Therefore, the new conditional segment layout is named DEMOELES-DEMOELES.
The test field is the field for which you want to set up a condition. To define a test, you need to expand the segment layout DEMOELES-DEMOELES in the right pane and expose the test field.
Whatever you type in here is used by the IMS Database Editor when deciding which segment layouts to apply to which segment occurrences.
If you had selected a condition that required two values, you would also type in a second value into the box on the far right.
In the right pane, the Segment Layout Editor window displays next to the test field.