Setting null values in a message in the MRM domain
You can use implicit or explicit null processing to set the value of an element to NULL in an output message.
About this task
To set a value of an element in an output message, you normally code an ESQL statement similar to the following one:
SET OutputRoot.MRM.Elem2.Child1 = 'xyz';
The equivalent statement is as follows:
SET OutputRoot.MRM.Elem2.Child1 VALUE = 'xyz';
If you set the element to a non-null value, these two statements give identical results. However, if you want to set the value to null, these two statements do not give the same result:
If you use the following statement to set the element to NULL, the element is
deleted from the message tree:
SET OutputRoot.MRM.Elem2.Child1 = NULL;
The content of the output bit stream depends on the physical format:
- For an XML element, neither the XML tag or attribute nor its value are included in the output bit stream.
- For a Delimited TDS element, neither the tag (if appropriate) nor its value are included in the output bit stream. The absence of the element is typically conveyed by two adjacent delimiters.
- For a CWF or Fixed Length TDS element, the content of the output bit stream depends on whether you set the Default Value property for the element. If you set this property, the default value is included in the bit stream. If you did not set the property, an exception is raised.
This behavior is called implicit null processing.
If you set the value of this element to NULL as follows, the element is not
deleted from the message tree. Instead, a special value of NULL is assigned to
the element. The content of the output bit stream depends on the settings of the
physical format null-handling properties.
SET OutputRoot.MRM.Elem2.Child1 VALUE = NULL;
This behavior is called explicit null processing.
Setting a complex element to NULL deletes that element and all its child elements.