Statements

Statements are the smallest executable entities within ITSMA Service Management. A statement is governed by the following rules.

  • A statement does not have a value.
  • A statement is comprised of expressions combined with key words.
  • The following BASIC language statements perform processing and looping: IF, WHILE and FOR. They can be nested. For example, for...to...if...then...else...if...then.
  • The following assignment statements are used: assign, increment, and decrement.
  • RAD functions can be used in statements to further define selection criteria and/or execute commands, initialize values, and perform calculations. Service Management syntax rules must be followed. The result of a RAD function can be assigned to a variable using the assign (=) assignment statement. For example, $string.length=lng($string).

The following table lists all of the statements available in Service Management.

Type Name Character Description and Examples
Assignment Assign =

Assigns the value of the right hand operand to the left hand operand.

Example:

$x=1 assigns 1 to $x
Assignment Increment + =

Increment the left hand operand by the right hand operand.

Example:

traditional: $x=$x+1 increments $x by 1
shortcut: $x += 1 increments $x by 1
Assignment Decrement - =

Decrement the left hand operand by the right hand operand.

Example:

traditional: $x=$x-1 decrements $x by 1
shortcut: $x -= 1 decrements $x by 1
Processing and looping FOR  

Allows you to perform a loop. You can set a variable, perform a statement, and increment the variable until the variable is greater than a maximum value. Format this statement as follows:

FOR variable name = initial value TO maximum value [DO] statement

The brackets ([ ]) indicate that the DO keyword is optional. Example:

for $I = 1 to 10 do ($J=$I*$I+$J)
Processing and looping IF  

Specifies a condition to be tested and a statement to be executed if the condition is satisfied and a statement to be executed if the condition is not satisfied. Format these statements as follows:

IF Boolean condition THEN statements [ELSE statements]

Example:

if ($location="Seattle") then ($x=$x+1) else ($x=$x - 1)

If Boolean condition evaluates to UNKNOWN, then neither statement is executed; therefore, HPE recommends using a default value when the condition evaluates to UNKNOWN.

Example:

if (nullsub($location,"Chicago")="Seattle") then ($x=$x+1) else ($x=$x - 1)

Processing and looping WHILE  

Specifies a condition to be tested and a statement to be executed when the condition is TRUE. Format these statements as follows:

WHILE (expression) [DO] statement

Example:

while ($x>6) do ($x=$x - 1;$y=$y - 1)

The brackets ([ ]) indicate that the DO keyword is optional.