Use the DataUpdate node to interact with a database in the specified ODBC data source. The DataUpdate node is a specialized form of the Database node, and the interaction is restricted to updating one or more rows in a table within the database. You define what is updated by defining mapping statements that use the data from the input message in some way to identify the action required.
You can set a property to control whether the update to the database is committed immediately, or deferred until the message flow completes, at which time the update is committed or rolled back according to the overall completion status of the message flow.
The DataUpdate node is represented in the workbench by the following icon:
Consider a scenario in which you have added the details of a new product, a keyboard, to your stock database. Now you have received a message from the Goods In department that indicates that 500 keyboards have been delivered to your premises. You can use the DataUpdate node to change the quantity of keyboards in your database from zero to 500.
When you have put an instance of the DataUpdate node into a message flow, you can configure it. To display its properties, right-click the node and click Properties. (If you double-click the DataUpdate node, you open the New Message Map dialog box.)
All mandatory properties for which you must enter a value (those that do not have a default value defined) are marked with an asterisk.
Configure the DataUpdate node as follows:
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.
If you click Browse next to this entry field, a dialog box is displayed that lists all available mapping routines that can be accessed by this node. Select the routine that you want and click OK; the routine name is set in Statement.
To work with the mapping routine that is associated with this node, double-click the node, or right-click the node and click Open Mappings. If the mapping routine does not exist, it is created for you with the default name in the default file. If the file exists already, you can also open file <flow_name>_<node_name>.mfmap in the Broker Development view.
A mapping routine is specific to the type of node with which it is associated; you cannot use a mapping routine that you have developed for a DataUpdate node with any other node that uses mappings (for example, a DataInsert node). If you create a mapping routine, you cannot call it from any other mapping routine, although you can call it from an ESQL routine.
For more information about working with mapping files, and defining their content, see Developing message mappings.
When you select the check 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 check 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 safely as a normal return code in most circumstances.
If you clear the check box, 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 could connect the Failure terminal to an error processing subroutine.
The terminals of the DataUpdate node 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 propagated if a failure is detected during the computation. If you have selected Treat Warnings as Errors, the node propagates the message to this terminal even if the processing completes successfully. |
Out | The output terminal that outputs the message following the execution of the database statement. |
The following tables describe the node properties. The column headed M indicates whether the property is mandatory (marked with an asterisk 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 Description properties of the DataUpdate node are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Node name | No | No | The node type | The name of the node. |
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. |
The DataUpdate node Basic properties are described in the following table.
Property | M | C | Default | Description |
---|---|---|---|---|
Data Source | No | Yes | The ODBC data source name of the database in which reside the tables to which you refer in the mappings that are associated with this node (identified by the Statement property). | |
Statement | Yes | No | DataUpdate | The name of the mapping routine that contains the statements that are to be executed against the database or the message tree. The routine is unique to this type of node. |
Transaction | Yes | No | Automatic | The transaction mode for the node. Valid values are Automatic and Commit. |
Treat Warnings as Errors | Yes | No | Cleared | If you select the check box, database SQL warnings are treated as errors. |
Throw Exception on Database Error | Yes | No | Selected | If you select the check box, database errors cause the broker to throw an exception. |