Safeguard Management Programming Manual (G06.29+, H06.08+, J06.03+)

Common Definitions
Safeguard Management Programming Manual422086-028
6-9
SAFECOM WHERE GROUP selection options
The first two bytes contain the length of the constant value that follows. This length
is always four because the only valid constant in this context is a group number,
which is represented in four bytes.
The next four bytes contain the group number represented as a binary number.
If the expression contains several group numbers, multiple ZSPI-TKN-SEL-
CONSTANT tokens are required to build an array of constants—one token to represent
each unique group number used in the expression. The elements in the constant array
match the order in which the constant tokens are listed.
Specifying Expressions
The ZSPI-TKN-SEL-EXPRESSION token is used to specify an evaluation expression,
which contains a list of the operands and instructions to be used in the comparison.
The instruction list is encoded in a byte string in postfix or reverse Polish notation:
ZSPI-TKN-SEL-EXPRESSION token-type ZSPI-TYP-BYTESTRING
The first two bytes contain the length of the expression.
Each comparison specified within the byte string uses three bytes in which you specify
the two operands to be compared and the operation to be performed. In postfix
notation, the operator follows the operands:
The first byte contains an index into the operand array and specifies the operand to
be used as the value on the left side in the comparison. The constant in a
comparison must be the value on the left side.
The second byte contains an index into the operand array and specifies the
operand to be used as the value on the right side in the comparison.
The third byte contains the comparison instruction ZSPI-VAL-SELOP-EQUAL-ANY.
If the expression contains a logical operation, one byte is required to specify the logical
operator. That byte contains either ZSPI-VAL-SELOP-AND or ZSPI-VAL-SELOP-OR to
indicate AND or OR operations, respectively. In postfix notation, the logical operation is
specified after two or more comparisons, as shown in the next examples.
ZSPI-VAL-SELOP-AND causes the results of the last two comparisons to be
examined. If both of those results are TRUE, the logical operation is also TRUE.
ZSPI-VAL-SELOP-OR causes the results of the last two comparisons to be examined.
If either of those results is TRUE, the logical operation is also TRUE.
Examples
This series of examples illustrates how to use the selection tokens to specify WHERE
GROUP options. For simplicity, the diagrams do not show the first two bytes of ZSPI-
TKN-SEL-EXPRESSION, which indicate the length of the expression.