Assignment statements

A value can be assigned to any variable or any simple element in the target document definition. This is accomplished using an assignment statement.

An assignment statement has the following format:

target = expression

Where:

target - is a path identifying a simple element in the target document definition or any defined variable.

expression - is any valid expression.

Data Interchange Services client attempts to convert the result from expression to the same data type of the target, if needed. If it is unable to make the conversion, an error is issued.

One method of creating an assignment statement is to drag a simple element from the source document definition or the target document definition and drop it on a variable. This creates an assignment command at the appropriate position within the Mapping Command window:

An assignment statement can also be created by doing a right-click on a node where you want to insert the statement. In the popup menu that appears, select an available Insert action, then select Command, and then Assignment.

Doing this opens the Mapping Command editor, where you will need to enter the target. Insert the target by dragging the appropriate variable or simple element from the target document definition to the target parameter in the Mapping Command editor. Enter the expression as needed, then click the OK button. This inserts the assignment statement where requested.

While in the Mapping Command editor, you can click the Insert button instead of the OK button. The OK button creates the command at the appropriate place in the Mapping Command window and then closes the Mapping Command editor. Clicking the Insert button creates the command at the appropriate place in the Mapping Command window, but the Mapping Command editor remains open. Another command can then be entered. When OK or Repeat is pressed, the new command is inserted in the Mapping Command editor immediately after the previously inserted command. Click the OK button when there are no more assignment commands to insert at the current position, or click the Cancel button if the last command at the current position has already been inserted.

Note:
Elements in the source document definition are read-only. You cannot update values in the source document. Elements in the target document definition are write-only. You may not read the value that has been assigned to an element in the target document.

Copyright IBM Corp. 2003, 2005