Open System Testing Architecture

TOC PREV NEXT INDEX



IF Command

Description:

This command performs tests on the values of variables against other variables or literals, and transfers control to a specified label depending upon the outcome of the tests.

Alternatively, structured IF commands may be used to perform one or more commands depending upon the success or failure of the tests.

By default, the matching is case sensitive. The strings "London" and "LONDON", for example, would not produce a match, because the case of the characters is not the same. This can be overridden by specifying the ", CASE_BLIND" clause.

Format:
 1.    IF condition GOTO label
 2.    IF condition THEN
         commands{s}
     { ELSEIF condition THEN
         command{s} }
              :
              :
     { ELSEIF condition THEN
         command{s} }
     { ELSE
         command{s} }
       ENDIF
Parameters:
condition

A condition of the following format:

  {NOT}(operand1 operator operand2 {, CASE_BLIND}) &
   {AND/OR condition ...}

The two operands may each be a variable, a quoted character string or an integer value.

The option "CASE_BLIND" may be specified for "operand2", to request a case-insensitive comparison of the operands.

"NOT" inverts the result of the bracketed condition that it precedes.

The binary operators are:

=
operand1 equals operand2
<>
operand1 does not equal operand2
<
operand1 is less than operand2
<=
operand1 is less than or equal to operand2
>
operand1 is greater than operand2
>=
operand1 is greater than or equal to operand2
^
operand1 contains operand2
CONTAINS
operand1 contains operand2
<^>
operand1 does not contain operand2
NOT CONTAINS
operand1 does not contain operand2
NOT_CONTAINS
operand1 does not contain operand2

All conditions are evaluated from left to right.

label

A label defined in the current scope of the script.

command

Any number of script commands - including further IF or DO commands, provided that the maximum nesting level of 100 is not exceeded.

Example:
 IF ( NOT(isub=10) AND (NOT(isub=99)) ) THEN                    
       LOG "...continued"                                       
 ELSE                                                           
       LOG " Completed loop"                                    
 ENDIF 

See also:

Flow Control Commands


OpenSTA.org
Mailing Lists
Further enquiries
Documentation feedback
CYRANO.com
TOC PREV NEXT INDEX