Using scratchpad areas in LocalEnvironment

The LocalEnvironment tree includes a subtree called Variables. This is always created, but is never populated by the message flow. Use this area for your own purposes, for example to pass information from one node to another. You can create other subtrees in the LocalEnvironment tree if you choose.

The advantage of creating your own data in a scratchpad in the LocalEnvironment is that this data can be propagated as part of the logical tree to subsequent nodes in the message flow. If you create a new output message in a Compute node, you can also include all or part of the LocalEnvironment tree from the input message in the new output message. If you want to do this, you must set the Compute mode property of the Compute node to include LocalEnvironment as part of the output tree (for example, specify All). (You also include the ExceptionList tree in your output message. See the Compute node for further details about Compute mode.)

However, any data updates or additions that you make in one node are not retained if the message flows backwards through the message flow (for example, if an exception is thrown, or if the message is processed through the second terminal of the FlowOrder node). If you create your own data, and want that data to be preserved throughout the message flow, you must use the Environment tree.

You can set values in the Variables subtree in a Compute node that are used later by another node (Compute, Database, or Filter) for some purpose that you determine when you configure the message flow.

For example, you might use this to determine the destination of an output message. Your first Compute node could determine in some way that the output messages from this message flow must go to WebSphere MQ queues. Include the following ESQL to insert this information into the LocalEnvironment scratchpad area in the message that the Compute node sends to the next node in the message flow:
SET OutputLocalEnvironment.Variables.OutputLocation = 'MQ';

Your second Compute node can access this information from its input message. In the ESQL in this node, use the correlation name InputLocalEnvironment to identify the LocalEnvironment tree within the input message that contains this data. Set the Compute mode to include the LocalEnvironment tree in the output message and copy the data from the InputLocalEnvironment to the Destination subtree in the output message. Configure the MQOutput node to use the destination list that you have created in the LocalEnvironment tree by setting property Destination Mode to Destination List.

For information about the full list of elements in the DestinationData subtree, see Data types for elements in the DestinationData subtree.

Related concepts
Message flows overview
LocalEnvironment tree
ESQL overview
Related tasks
Designing a message flow
Related reference
Compute node
Database node
Filter node
Data types for elements in the DestinationData subtree
ESQL reference
SET statement