WHEREIS, WHEREISLAST


9.0

 

The WHEREIS instruction scans a string for the first occurrence of another string. WHEREISLAST scans the string in reverse order. The instructions use the following format:

 

 

[label]

WHEREIS

{source}{sep}{search}[{sep2}{result}]

 

[label]

WHEREISLAST

{source}{sep}{search}[{sep2}{result}]

 

Where:

label

Optional. A Program Execution Label.

source

Required. A previously defined Character String Variable, literal, equated character value, or a character value for which to search.

sep

Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.

search

Required. A Character String Variable or Literal whose logical string is searched.

sep2

Optional. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, INTO, or GIVING.

result

Optional. A Numeric Variable that receives the form pointer value in the {search} string where the {source} string was found.

Flags Affected: EOS, OVER, ZERO

Note the following:

  1. The {source} and {search} variables are not changed by the operation of this instruction.

  2. The EOS flag is set TRUE if the {source} or {search} is NULL.

  3. The ZERO flag is set FALSE when the {source} string is found in the {search} variable. If the optional {result} variable is specified, the form pointer value of the located string is stored. The ZERO flag is set if the {source} string is not found in the {search} string.

  4. WHEREIS searches in a forward order. WHEREISLAST (9.1.C) seaches backward.

  5. The OVER flag is set TRUE if {result} is too small to receive the form pointer value.

 

 

See Also: Example Code, Character String Instructions

 



PL/B Language Reference UPPERCASE XOR