TEST
The TEST instruction logically ANDs the source with the destination and sets the condition flags based upon the bit pattern in both fields. It uses one of the following formats:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
source1
Required. A previously defined Character String Variable, single character Literal, decimal constant, or equivalent {ctrl} character that is compared with the {dest} operand.
sep
Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.
dest1
Required. A previously defined Character String Variable that is compared with the {source} operand.
source2
Required. A previously defined INTEGER variable that is compared with the {dest} operand.
dest2
Required. A previously defined INTEGER that is compared with the {source} operand.
source3
Required. A previously defined Character String Variable or Numeric Variable that is tested.
object
Required. A previously defined object variable that is tested.
Flags Affected: EOS, ZERO, LESS
Note the following:
The {source} and {dest} variables remain unchanged.
Using format (1) with string variables, the Form Pointed character is processed against the Form Pointed character in {dest}.
Using format (2) with integer variables, the entire {source} integer field is processed against the entire {dest} integer field.
If the {source} or {dest} is a Null String, the EOS Condition Flag is set.
If the result when using format (1) or (2) is zero, the ZERO Condition Flag is set.
Any bit in the character may be manipulated (not just those below octal 200 or hex 80).
The following truth table indicates the results of the operation on each bit:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Using format (3) with a numeric variable, the ZERO Condition Flag is set if the value of {source} is zero (0). If the value of {source} is non-zero, ZERO is cleared. If the value is less than zero (0), LESS is set; otherwise, LESS is cleared.
Using format (3) with a character variable, the EOS Condition Flag is set if the form pointer of {source} is zero (0). If the form pointer of {source} is non-zero, the EOS Condifition Flag is cleared.
Using format (4), the ZERO flag is set when the {object} is not created. Otherwise, the ZERO flag is cleared when the {object} is created. The EOS and LESS flags are always cleared when this syntax form is used. This mode was added in version 9.1.A.
See Also: Example Code, AND, NOT, OR, SET, XOR, Character String Instructions
![]() |