Accessing embedded simple types in migrated message models

In previous releases, you could embed a simple type within a compound type in the message model. This allowed the anonymous text that can occur between the XML tags to be modeled. These simple types are referred to as embedded simple types to distinguish them from XML schema simple types. This topic is only applicable if you are working with messages that you modeled in a previous release and have imported using mqsimigratemsgsets command.

When an MRM message is parsed into a logical tree, embedded simple types do not have identifiers that uniquely define them in ESQL. If you want to interrogate or update the data held in an embedded simple type, you must refer to it in relation to other known objects in the message.

For example, if you want to update the embedded simple type with the text Mr. Smith, include the following ESQL in your Compute node:

SET OutputRoot.MRM.Person.*[3] = 'Mr.Smith';

This statement sets the third child of the element Person to Mr.Smith. Because this statement addresses an anonymous element in the tree (an embedded simple type that has no name), you can set its value only if you know its position in the tree.

Consider the following MRM XML message:

<Mess1>
  <Elem1>abc</Elem1>
  <Elem2>def<Child1>ghi</Child1></Elem2>
</Mess1>

You can model this XML message in the MRM using the following objects.

Message
The message Name property is set to Mess1 to match the XML tag.

The Type property is set to tMess1.

Type
The complex type Name property is set to tMess1.

The Composition property is set to Ordered Set.

The complex type contains the following objects:

Element
The Name property is set to Elem1 to match the XML tag.

The Type property is set to XML Schema simple type xsd:string.

Element
The Name property is set to Elem2 to match the XML tag.

The Type property is set to complex type tElem2.

Type
The complex type Name property is set to tMess2.

The Composition property is set to Sequence.

The complex type contains the following objects:

Element
The Name property is set to Child1 to match the XML tag.

The Type property is set to XML Schema simple type xsd:string.

Embedded Simple Type
ComIbmMRM_BaseValueString

The embedded simple type ComIbmMRM_BaseValueString that is embedded within tMess2 is used to parse the data def from the input message. If you want to change the value of the data associated with the embedded simple type on output, code the following ESQL:

SET OutputRoot.MRM.Elem2.*[1] = 'xyz';

This generates the following output message:

<Mess1>
  <Elem1>abc</Elem1>
  <Elem2>xyz<Child1>ghi</Child1></Elem2>
</Mess1>

If you prefer not to model this message in the MRM, you can achieve the same result with the following ESQL:

SET OutputRoot.XML.Elem2.*[1] = 'xyz';

An embedded simple type does not have the facilities for null handling that is provided with elements. If you set an embedded simple type to null, it is deleted from the message tree.

In ESQL, element names are typically used to refer to and update MRM elements. The exception is when embedded simple types are present in the message. If you are using multipart messages, you must specify the message name to further qualify the embedded simple type references if the message is not the first message object in the bit stream. Accessing embedded messages in the MRM domain provides further information.

Related concepts
Message flows overview
ESQL overview
Message modeling
Related tasks
Designing a message flow
Defining message flow content
Managing ESQL files
Migrating a message set
Related reference
Compute node
Database node
Filter node
ESQL reference
SET statement