Querying null values in a message in the MRM domain

You can use an ESQL statement to compare an element to NULL.

About this task

If you want to compare an element to NULL, code the statement:

IF InputRoot.MRM.Elem2.Child1 IS NULL THEN
   DO:
    -- more ESQL --
END IF;

If nulls are permitted for this element, this statement tests whether the element exists in the input message, or whether it exists and contains the MRM-supplied null value. The behavior of this test depends on the physical format:

  • For an XML element, if the XML tag or attribute is not in the bit stream, this test returns TRUE.
  • For an XML element, if the XML tag or attribute is in the bit stream and contains the MRM null value, this test returns TRUE.
  • For an XML element, if the XML tag or attribute is in the bit stream and does not contain the MRM null value, this test returns FALSE.
  • For a delimited TDS element, if the element has no value between the previous delimiter and its delimiter, this test returns TRUE.
  • For a delimited TDS element, if the element has a value between the previous delimiter and its delimiter that is the same as the MRM-defined null value for this element, this test returns TRUE.
  • For a delimited TDS element, if the element has a value between the previous delimiter and its delimiter that is not the MRM-defined null value, this test returns FALSE.
  • For a CWF or fixed length TDS element, if the element's value is the same as the MRM-defined null value for this element, this test returns TRUE.
  • For a CWF or fixed length TDS element, if the element's value is not the same as the MRM-defined null value, this test returns FALSE.

If you want to determine if the field is missing, rather than present but with null value, you can use the ESQL CARDINALITY function.