Expressions are calculation rules which, after evaluation, return a value. They are formed by combining operands with operators (see section "Syntax diagrams"). The meanings of the operator symbols are shown in the following table:
Numeric | String | Bit pattern | |
+ | Addition | Concatenation | Set union |
- | Subtraction | Set difference | |
* | Multiplication | Replication *) | Set intersection |
/ | Division | ||
MOD | Modulo operation |
*) | The second operand must in this case be numeric. |
In PRODAMP, the operators are thus ambiguous, i.e. they are interpreted differently for different operand types.
Examples
33 + 16 Result: 49 X'10' * 4 Result: 64 'System' + ' crash' Result: 'System crash' #'C1' * 5 Result: 'AAAAA' B'1001' + B'11' Result: B'1011' or P'0B' P'1A' * B'1001' Result: B'1000' or P'08'
The modulo operation returns the (integer) remainder left over by a division. Examples
Examples
29 MOD 7 produces 1 35 MOD 11 produces 2
The MOD operand can also be used, for example, to convert addresses “manually” to 24-bit addresses.
Example
X'887C0A0E' MOD X'01000000' Result: X'007C0A0E'
Expressions can be enclosed in parentheses in the normal manner and can be combined as required (providing the types are compatible).
Examples
X * Y + 3 * ( A - B ) + X'ABC' A_FCB.ID2IND1 - P'80' All bits from ID2IND1 except ID2DUMMY NUM - ( NUM / 16 ) * 16 ('a'+'b'*2) * 4 Result: 'abbabbabbabb'