FINDCHAR


NCHAR

 

The FINDCHAR instruction locates the first occurrence of any character of the source variable in the destination variable. The instruction uses the following format:

 

 

[label]

FINDCHAR

{source}{sep}{dest}[{sep}{output}]

 

Where:

label

Optional. A Program Execution Label.

source

Required. A previously defined Character String Variable or National Character String Variable containing the characters for which to search.

sep

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

dest

Required. A previously defined Character String Variable or National Character String Variable that is searched.

output

Optional. A previously defined Character String Variable or National Character String Variable that will contain the located character if any.

Flags Affected: EQUAL

Note the following:

  1. Only the Logical Strings of the {source} and {destination} variables are used by this operation.

  2. If any one character in the {source} variable is located in the {dest} variable, the EQUAL flag is set and the Form Pointer will point to the located character in the {dest} variable. If the search was unsuccessful, the EQUAL flag is cleared and no variables are changed.

  3. If the search is successful, the optional {output} variable will contain the character that has been located in the {dest} variable. Otherwise, the {output} variable is cleared.

  4. If {source} or {dest} is a Null String variable, no search is performed, the EQUAL flag is cleared and the optional {output} variable is not changed.

 

 

See Also: Example Code, Character String Instructions

 



PL/B Language Reference FILL HASH