SEGLEN

Figure 1. Syntax

1 SEGLEN(field_name)

Can only be used in criteria for a segmented template.

Returns the length in the associated field name. This result is used as the segment length for the identified segment if the value is greater than zero.

field_name
Must be a valid field name for the current layout.
Note:
  1. The field name is converted to a full word positive integer.
  2. If the field is alphanumeric then it is assumed to contain a binary value. If it is longer than 4 bytes then the rightmost 4 bytes are used to obtain the binary value.
  3. The last value returned by the SEGLEN function in successful identification criteria is used as the segment length. This takes precedence over the specification of a segment length field in a template definition.

For example, Consider the excerpt from an XML template with identification criteria for a section of the SMF 30 record SMF30PSS. The length of the section is in the header section SMFRCD30 field SMF30SLN. When the identification criteria for section SMF30PSS is satisfied the segment length is set to the value contained in the header field SMF30SLN.

<layout name="SMFRCD30" offset="-4">
  <criteria type="RID" rname="SMF30PSS">
    <exp><![CDATA[
      segcnt('smf30pss') < #SMF30SON &
      segoff(4) >= #SMF30SOF &
      seglen('SMF30SLN') > 0
    ]]></exp>
  </criteria>
</layout>