Information icon IBM Information Server, Version 8.1
Feedback

Using arithmetic expressions

You can include arithmetic expressions as the left operand of a conditional expression.

The available arithmetic operators are:

+ Addition
Subtraction
* Multiplication
/ Division
% Modulus

Arithmetic is limited to one operation per expression. Parentheses are not permitted. The modulus operation is the remainder of an integer division. For example, x % 2 is zero if the number is divisible by two. It is one if the number is odd.

An arithmetic expression is

left-arithmetic-operand arithmetic-operator right-arithmetic-operand
Operation Valid Value
left-arithmetic-operand variable-name{field-identifier}{}
arithmetic-operator
+
–
*
/
%
right-arithmetic-operand variable-name constant

Examples of arithmetic expressions are:

temp –2 The value of temp –2
{} % 2 The current operand value of modulo 2

The following conditional expression is for matching to even numbered houses.

^ [{} % 2 = 0]

Even numbers are divisible by two, thus the house number modulo two is zero. The arithmetic expression appears on the left side of the relational operator (the equal sign).

The following is a conditional expression to see if the current operand divided by three is greater than the contents of variable temp:

^ [{} / 3 > temp]

Again, note that the field references and the arithmetic expression are to the left of the relational operator. Other examples are:

[ temp * temp2 > temp3 ]
[ {ZP} + 4 > 12345]

PDF This topic is also in the IBM WebSphere QualityStage Pattern Action Reference.

Update icon Last updated: 2008-09-30