Specifying layout identification criteria
In a template, if a segment type has more than one layout, you need to specify layout identification criteria for each layout of that segment type.
When you use a view (based on the template) to browse or edit a database containing that segment type, FM/IMS determines which layout to use by comparing occurrences of that segment type with the layout identification criteria. If the segment data matches the layout identification criteria for more than one layout, FM/IMS uses the first matching layout (according to the order of the layouts in the copybook). If the data matches none of the layout criteria, then the segment is flagged to identify it as not having matched any layout criteria.
For example, in the COBOL copybook in Template and copybook concepts, all three layouts
contain a SHIRE-TYPE field. If SHIRE-TYPE contains 0
for SHIRE, 1
for SHIRE-TOWN, and
2
for SHIRE-CITY, you can specify #4=0 as the layout identification criteria for the SHIRE
layout, #4=1 for SHIRE-TOWN and #4=2 for SHIRE-CITY (where #4 is a field reference to SHIRE-TYPE).
When browsing or editing data, FM/IMS uses the appropriate
layout to display occurrences of that segment type, depending on the value of SHIRE-TYPE.
To specify layout identification criteria:
- From the Template Specification panel, type an
E
in the Cmd field adjacent to the segment that you want to view, then press Enter. If the copybook member has more than one Level 01 layout definition for this segment, the Template : Segment Layout Selection panel is displayed. - Type an
E
in the Cmd field adjacent to the layout that you want to edit, then press Enter. The Template : Segment Layout panel is displayed. - Specify the segment identification criteria by
doing one of:
- Enter a freeform REXX expression in the ID field. You can scroll to the right or left within the field, using the Right (F11) or Left (F10) function keys, or you can expand the field, using the Expand function key (F4).
- Entering the 1 primary command, to display the Layout Identification Criteria panel and then building your criteria statement using the fields on this panel.
- Press the Exit function key (F3) to return to the Template Layout Selection panel, and repeat these steps for each Level 01 layout.
- When you have assigned layout identification criteria to all the layouts, press F3 again to return to the Template Specification panel and save your template.
Related topics