This topic contains the following sections:
Use the Compute node to construct one or more new output messages. These output messages might be created by modifying the information that is provided in the input message, or the output messages might be created using only new information which might (or might not) be taken from a database. Elements of the input message (for example, headers, header fields, and body data), its associated environment, and its exception list can be used to create the new output message.
You specify how the new messages are created by coding ESQL in the message flow ESQL resource file. You can both create and modify the components of the message using ESQL expressions, and can refer to elements of both the input message and data from an external database. An expression can use arithmetic operators, text operators (for example, concatenation), logical operators, and other built-in functions.
Use the Compute node to:
You define the ESQL statements in a module associated with this node in the ESQL .esql) file associated with this message flow. You must create this file to complete the definition of the message flow.
The Compute node is represented in the workbench by the following icon:
Look at the following samples to see how you can use this node:
Consider a message flow in which you want to give each order that you receive a unique identifier for audit purposes. The Compute node does not modify its input message; it creates a new, modified copy of the message as an output message. You can use the Compute node to insert a unique identifier for your order into the output message, which can be used by subsequent nodes in the message flow.
When you have put an instance of the Compute node into a message flow, you can configure it. Right-click the node in the editor view and click Properties. The node's basic properties are displayed.
All mandatory properties for which you must enter a value (those that do not have a default value defined) are marked with an asterisk on the properties dialog.
Configure the Compute node by:
When you have completed your configuration, click Apply. This makes the changes to the Compute node without closing the properties dialog. Click OK to apply the changes and close the properties dialog. Click Cancel to close the dialog and discard all the changes that you have made to the properties.
If you want to access a database from this node:
On z/OS systems, the broker uses the broker started task ID, or the user ID and password that were specified on the mqsisetdbparms command JCL, BIPSDBP in the customization data set <hlq>.SBIPPROC.
The value that you choose is implemented for the one or more database tables that you have added: you cannot select a different value for each table.
When you select the box, the node handles all positive return codes from the database as errors and generates exceptions in the same way as it does for the negative, or more serious, errors.
If you do not select the box, the node treats warnings as normal return codes, and does not raise any exceptions. The most significant warning raised is not found, which can be handled as a normal return code safely in most circumstances.
If you clear the box, you must include ESQL to check for any database error that might be returned after each database call that you make (you can use SQLCODE and SQLSTATE to do this). If an error occurs, you must handle the error in the message flow to ensure the integrity of the broker and the database: the error is ignored if you do not handle it through your own processing, because you have chosen not to invoke the default error handling by the broker. For example, you can include the ESQL THROW statement to throw an exception in this node, or you can use the Throw node to generate your own exception at a later point in the message flow.
Code ESQL statements to customize the behavior of the Compute node. For example, you can customize it to create a new output message or messages, using input message or database content (unchanged or modified), or new data. For example, you might want to modify a value in the input message by adding a value from a database, and store the result in a field in the output message.
Code the ESQL statements that you want in an ESQL file associated with the message flow in which you have included this instance of the Compute node. The ESQL file, which by default has the name <message_flow_name>.esql, contains ESQL for every node in the message flow that requires it. Each portion of code that is related to a specific node is known as a module.
If an ESQL file does not already exist for this message flow, right-click the Compute node and click Open ESQL. This creates and opens a new ESQL file in the ESQL editor view.
If the file already exists, click the Browse button beside the ESQL Module property. This displays the Module Selection dialog, which lists the available Compute node modules defined in the ESQL files that are accessible by this message flow (ESQL files can be defined in other, dependent, projects). Select the appropriate module and click OK. If no suitable modules are available, the list is empty.
If the module that you have specified doesn't exist, it is created for you and the editor positions the file to display it. If the file and the module already exist, the editor positions the file and displays and highlights the correct module.
If you prefer, you can open the appropriate ESQL file in the Resource Navigator and select this node in the Outline view.
If a module skeleton is created for this node in a new or existing ESQL file, it consists of the following ESQL. The default module name is shown in this example:
CREATE COMPUTE MODULE <flow_name>_Compute CREATE FUNCTION Main() RETURNS BOOLEAN BEGIN -- CALL CopyMessageHeaders(); -- CALL CopyEntireMessage(); RETURN TRUE; END; CREATE PROCEDURE CopyMessageHeaders() BEGIN DECLARE I INTEGER 1; DECLARE J INTEGER CARDINALITY(InputRoot.*[]); WHILE I < J DO SET OutputRoot.*[I] = InputRoot.*[I]; SET I = I + 1; END WHILE; END; CREATE PROCEDURE CopyEntireMessage() BEGIN SET OutputRoot = InputRoot; END; END MODULE;
DECLARE I INTEGER 1;by
DECLARE I INTEGER; SET I=1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);by
DECLARE J INTEGER; SET J=CARDINALITY(InputRoot.*[]);
If you create your own ESQL module, you must create this skeleton exactly as shown except for the procedure calls and definitions (described below). You can change the default name, but ensure that the name you specify matches the name of the corresponding node property ESQL Module. If you want the module name to include one or more spaces, enclose the name in double quotes in the ESQL Module property.
Add your own ESQL to customize this node after the BEGIN statement that follows CREATE FUNCTION, and before RETURN TRUE. You can use the two calls included in the skeleton, to procedures CopyEntireMessage and CopyMessageHeaders.
These procedures, defined following function Main, provide common functions that you might want when you manipulate messages. The calls in the skeleton are commented out; remove the comment markers if you want to use the procedure. If you do not want to use a procedure, remove both the call and the procedure definition from the module.
In previous releases, the functions performed by these procedures were provided by the two equivalent Compute node radio buttons on the properties dialog.
You can also create an ESQL file using the
.When you select the Compute mode, you specify whether the Message, LocalEnvironment (previously specified as DestinationList), and Exception List components, that are either generated within the node or contained within the incoming message, are used by default in the output message.
This default is used when the transformed message is routed to the Out terminal when processing in the node is completed. The default is also used whenever a PROPAGATE statement does not specify the composition of its output message.
Those components that are not included in your selection are passed on unchanged; even if you modify those components, the updates are local to this node.
The Environment component of the message tree is not affected by the mode setting. Its contents, if any, are passed on from this node in the output message.
You must set this property to correctly reflect the output message format that you require. If you select an option (or accept the default value) that does not include a particular part of the message, that part of the message is not included in any output message that is constructed.
The options are explained in the following table.
Mode | Description |
---|---|
Message (the default) | The message is generated or passed through by the Compute node as modified within the node. |
LocalEnvironment | The LocalEnvironment tree structure is generated or passed through by the Compute node as modified within the node. |
LocalEnvironment And Message | The LocalEnvironment tree structure and message are generated or passed through by the Compute node as modified by the node. |
Exception | The Exception List is generated or passed through by the Compute node as modified by the node. |
Exception And Message | The Exception List and message are generated or passed through by the Compute node as modified by the node. |
Exception and LocalEnvironment | The Exception List and LocalEnvironment tree structure are generated or passed through by the Compute node as modified by the node. |
All | The message, Exception List, and LocalEnvironment are generated or passed through by the Compute node as modified by the node. |
Because the Compute node has both an input and output message, you can use ESQL to refer to fields in either. You can also work with both InputLocalEnvironment and OutputLocalEnvironment, and InputExceptionList and OutputExceptionList, as well as the input and output message bodies.
Set the validation properties to define how the message that is produced by the Compute node is to be validated. Note that these properties do not cause the input message to be validated. It is expected that, if such validation is required, the validation has already been performed by the input node or a preceding validation node.
For more details refer to Validating messages and Validation properties for messages in the MRM domain.
The Compute node terminals are described in the following table.
Terminal | Description |
---|---|
In | The input terminal that accepts a message for processing by the node. |
Failure | The output terminal to which the input message is routed if an unhandled exception occurs during the computation. |
Out | The output terminal to which the transformed message is routed when processing in the node is completed. The transformed message might also be routed to this terminal by a PROPAGATE statement. |
Out1 | The first alternate output terminal to which the transformed message might be routed by a PROPAGATE statement. |
Out2 | The second alternate output terminal to which the transformed message might be routed by a PROPAGATE statement. |
Out3 | The third alternate output terminal to which the transformed message might be routed by a PROPAGATE statement. |
Out4 | The fourth alternate output terminal to which the transformed message might be routed by a PROPAGATE statement. |
The following tables describe the node properties; the column headed M indicates whether the property is mandatory (marked with an asterisk on the properties dialog if you must enter a value when no default is defined), the column headed C indicates whether the property is configurable (you can change the value when you add the message flow to the bar file to deploy it).
The Compute node Basic properties are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Data Source | No | Yes | The ODBC data source name for the database within which reside any tables to which you refer in the ESQL file associated with this message flow (identified in the ESQL Module property). You can specify only one data source for the node. | |
Transaction | Yes | No | Automatic | The transaction mode for the node. This can be Automatic or Commit. It is valid only if you have selected a database table for input. |
ESQL Module | Yes | No | Compute | The name of the module within the ESQL file that contains the statements to execute against the database and input and output messages. |
Compute Mode | Yes | No | Message | Choose from:
|
Treat warnings as errors | Yes | No | Cleared | Treat database SQL warnings as errors. If you select the check box, this action is performed. |
Throw exception on database error | Yes | No | Selected | Database errors cause the broker to throw an exception. If you select the check box, this action is performed. |
The Validation properties of the Compute node are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Validate | Yes | Yes | None | Whether validation takes place. Valid values are None, Content and Value, Content, and Inherit. |
Failure Action | Yes | No | Exception | What happens if a validation failure occurs. You can set this property only if Validate is set to Content or Content and Value. Valid values are User Trace, Local Error Log, Exception, and Exception List. |
Include All Value Constraints | Yes | No | Selected | This property cannot be edited. The default action, indicated by the check box being selected, is that all value constraints are included in the validation. |
Fix | Yes | No | None | This property cannot be edited. Minimal fixing is provided. Valid values are None, and Full. |
The properties of the General Message Options for the MQGet node are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Parse Timing | Yes | No | On Demand | This property controls when an input message is parsed.
Valid values are On Demand, Immediate, and Complete. Refer to Parsing on demand for a full description of this property. |
Use MQRFH2C Compact Parser for MQRFH2 Domain | No | No | False | This property controls whether the MQRFH2C Compact Parser, instead of the MQRFH2 parser, is used for MQRFH2 headers. |
The XMLNSC parser properties for the Compute node are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Use XMLNSC Compact Parser for XMLNS Domain | Yes | Cleared | No | ![]() ![]() |
Mixed Content Retain Mode | Yes | No | None | This property controls whether the XMLNSC parser creates elements in the message tree when it encounters mixed text in an input message. Valid values are None and All. Selecting All means that elements are created for mixed text. Selecting None means that mixed text is ignored and no elements are created. |
Comments Retain Mode | Yes | No | None | This property controls whether the XMLNSC parser creates elements in the message tree when it encounters comments in an input message. Valid values are None and All. Selecting All means that elements are created for comments. Selecting None means that comments are ignored and no elements are created. |
Processing Instructions Retain Mode | Yes | No | None | This property controls whether the XMLNSC parser creates elements in the message tree when it encounters processing instructions in an input message. Valid values are None and All. Selecting All means that elements are created for processing instructions. Selecting None means that processing instructions are ignored and no elements are created. |
The Compute node Description properties are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Short Description | No | No | A brief description of the node. | |
Long Description | No | No | Text that describes the purpose of the node in the message flow. |
Notices |
Trademarks |
Downloads |
Library |
Support |
Feedback
![]() ![]() |
ac04660_ |