Segments with multiple layouts
The COBOL or PL/I language layouts for segments are specified using the File-AID for IMS/ISPF XREF facility. This facility, which is fully described in Segment-layout-cross-reference, enables you to identify that a segment has multiple language layouts. The applicable layout is determined by the values in a TYPE1, and possibly TYPE2, field of the segment. When the XREF facility is used to specify these fields, the column number and length of each field, rather than the field name, are used to specify that field. File-AID for IMS/FLEX uses $RTV1 and $RTV2 as the field names for the TYPE1 and TYPE2 values.
If a segment has multiple layouts and the INSERT, CHANGE, or DELETE sub-command is specified for the segment, the WHERE keyword on the SELECT primary command must be used to explicitly specify the layout or set of applicable layouts.
Field names $RTV1 and $RTV2 must be used with the WHERE keyword to supply the values of the fields that determine the layout. You can use multiple field names with logical connectors to allow a set of layouts to be applicable.
If you want to indicate that any of the multiple layouts for the segment are acceptable, use $RTV1=$ALL. $ALL is not valid with $RTV2. Because multiple values determine the OTHER (or default) layout, $RTVn=$OTHER can be used to indicate that the OTHER layout is acceptable.
When the CHANGE or PRINT sub-command is specified, all the fields specified with the SET or FIELD keyword must be present in each of the layouts included in the applicable set of layouts. A check for this condition is made during the validation process. The same field name can be present at different offsets in different layouts. When the segment to be changed is read, the layout for that segment is determined. If the layout is not in the set of layouts specified, the segment does not satisfy the WHERE clause. If the segment does satisfy the WHERE clause, the appropriate layout is used to make the change.
File-AID for IMS/FLEX allows the change function to change the value of the field that determines the layout. The resultant value must be a valid layout value. All SET keyword values of the CHANGE sub-command are processed using the layout determined when the segment was read.
When the INSERT sub-command is specified, the segment to be inserted can use a different layout than that defined by the WHERE keyword. To insert a segment, use field names $RTV1 and, if applicable, $RTV2 as the field names on the SET keyword to supply the values of the fields that are used to determine the applicable layout. File-AID for IMS/FLEX verifies that the values supplied are valid and ensures that all other field names specified by other SET keywords of the INSERT are valid for the layout. If the columns covered by the $RTV1 and $RTV2 fields are also supplied by other SET fields within this INSERT, the values cannot be different than those supplied by the $RTVn names.
If no INSERT, CHANGE, or DELETE sub-command function applies to the multiple layout type segment, then it is not necessary to specify the applicable layouts with the WHERE clause. Any segment that satisfies the WHERE clause is acceptable, and the appropriate layout is then determined when the segment is read. During the validation phase a check is made to ensure that all the field names used in the WHERE clause are present in at least one layout.
Related topics