Create a Conditional Segment Layout for DEMOELES

Walks you through the process of creating a conditional segment layout for a defined segment type.

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 can define one or more conditional segment layouts for a single segment type.

Define a conditional segment 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.

  1. Drag 01 DEMOELES from the left pane of the window across to the right pane.
  2. Select the DEMOELES segment name; then click Next.
  3. As Conditional Layout is already selected, click Next.
  4. Click Finish.

    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.

Define a test for the conditional segment layout

A test field determines which DEMOELES segment occurrences use the conditional layout rather than the default layout. In this case, you define a condition for the 03 FILLER PIC X(133) field.

  1. Expand the conditional segment layout DEMOELES-DEMOELES in the right pane by clicking  until you can see the test field 03 FILLER PIC X(133). This test field is under the group item 02 DEMOELES-ELE-DATA.
  2. Right-click 03 FILLER PIC X(133), and then select Properties from the context menu.
  3. From the IF drop-down list, select IS = TO.
  4. In the box to the right of the IF list box, type IMS DC TEST TECHNICIAN.

    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.

  5. Click OK.

    In the right pane, the Segment Layout Editor window displays  next to the test field.

  6. Click Save to save the conditional segment in DEMO03DD.SLF.

Close Micro Focus Data File Tools

  • From the Micro Focus Data File Tools menu, click File > Exit to close the window.

This concludes the tutorial.