Rules functions


The following sections describe general syntax rules for using Rules functions on the Selection Criteria panel (S1), the Advanced Variable Dependencies (ASV) panel, and the Advanced Set Variables (AAV) panel and how to use operators, comparison operators, connector operators, and built-in Rules functions.

This topic includes the following sections:

Understanding syntax

The following rules apply when coding and evaluating strings or equations:

  • White space (blanks) is permitted between operands, operators, and function arguments to improve readability.
  • Use single quotation marks before and after any string that you code that contains one or more reserved words, operators, or comparator symbols to have them treated as a literal. Literals specified in this way will be used as is and are not interpreted (resolved). White space can be embedded in literals that use single quotation marks as well. For example:
    • 'THIS IS A TEST MESSAGE'
    • 'SUBSTR() SHOULD ALWAYS BE = 12'
  • Single quotation marks should not be used anywhere in the arguments to a function except when using the VALUE() function. If single quotation marks are needed as the strip character (argument #3) for the STRIP() function, you should use the X() function of X(7D) to do this.
  • Side-by-side single quotation marks (no data between them) may be used to specify a null value. The NULL() function can also be used for this purpose. For example, you can test a variable for a null value setting in two ways:
    • &MVYVAR<>NULL()
    • &MVVAR<>''
  • Double quotation marks are not supported. If a double quotation mark is needed, use the X() function of X(7F) instead.
  • Built-in Rules functions can be nested. For example, SUBSTR(&WORD1,POS(&WORD1,A),3) is a permitted expression.
  • Built-in Rules functions can use a variable as any argument of the function as needed. For example, SUBSTR(&WORD1,&WORD2,4).
  • All variable names must be preceded with an ampersand (&) to be considered a variable.
  • Built-in Rules function arguments are always separated with a comma (,). The use of a semicolon is not supported.
  • All comparisons are done by using like types. You must ensure that each side of the equation is in like type by using built-in Rules functions if necessary; for example:
    • If both operands are numeric (characters 0-9), a numeric comparison is done. For example, if the equation resolves to 23&gt;10, a numeric comparison is calculated.

      The maximum value that can be numerically compared is 2,147,483,647. For values larger than this, the two operands are compared as character strings.

    • If one operand contains a real number (has a decimal point and digits to the right of it) and the other operand is numeric, a real number numerical comparison is done.
    • If either operand contains non-numeric characters, a simple string comparison is done. Strings of different lengths will have the shorter string padded with blanks to the right to match the longer length operand.

Operators

The following table shows the valid operators that you can use and the data type required to use them.

The following restrictions apply when using these operators:

  • Math operators can only be used on integer values.
  • Math that uses real numbers (those with a decimal point in them) is not supported.
  • Math with null operands is unpredictable and therefore returns a numeric result of 0.


Symbol

Operation

Required operands

+

Add

2 numeric integer operands

-

Subtract

2 numeric integer operands

*

Multiply

2 numeric integer operands

/

Divide

2 numeric integer operands

||

Concatenate

2 operands of any type

( )

Grouping

Parentheses may be used to indicate precedence as needed.

Comparison operators

Comparisons are done using the most precise, like data type possible that can be determined at run time. For example, two numeric integer operands will have a true numeric comparison done. Two numeric real-number operands will have a real-number numeric compare done. If one or both of the operands is non-numeric, a simple character compare is done with the shorter operand padded with blanks to the right if needed.


Symbol

Operation

=

Equal to

>

Greater than

<

Less than

<=, =<

Less than or equal

>=, =>

Greater than or equal

<>=,

Not equal

!>

Not greater than

!<

Not less than

Connector operators

This topic provides a table that shows the list of supported operators.


Symbol

Meaning

Description

AND

Logical AND

Both sides of the connector must be true for the end condition to be TRUE otherwise the end condition is FALSE.

OR

Logical OR

If either side of the connector is TRUE then the end condition is TRUE otherwise the end condition is FALSE.

Reserved words

To use a reserved word in any formula you must enclose the reserved word in single quotation marks.

All built-in Rules function names, operators, comparison operators, and connector operators are reserved words. Additionally, the exclamation point (!) is also a reserved word. It can still be used to construct a compound variable however. BMC recommends that the REXX() built-in be used on the ASV panel to construct compound variables instead of the exclamation point. The REXX() function is more intuitive and flexible and will result in fewer coding problems in your rules. An exclamation point should always be enclosed in single quotation marks unless it is used in a compound variable or as a comparison operator ( != !< !> ).

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*

BMC AMI Ops Automation 8.3.01