Previous Topic: &FLUSH

Next Topic: &GOSUB


&FNDSTR

Returns a numeric value indicating the presence of a search string within a supplied text.

&FNDSTR string text

&FNDSTR is used to search one or more variables to determine if a specified string exists within any of those variables.

Use &FNDSTR to search text to determine if a specified string exists within it. If the specified string is found within the first word of the text, the offset into that word is returned. This value can subsequently be used in an &SUBSTR statement if required.

If the specified string is found in a word other than the first, the value 999 is returned. If the specified string is not found, the value 0 is returned.

Operands:

string

The search string-if this string contains blanks, it must be specified in the &FNDSTR statement as a single variable. Specifying string with multiple variables is not valid. See example below.

text

The text string that is to be searched. If the search argument is found within the first word of the text, the offset to the string in the word is returned. If it is found in other than the first variable, a value of 999 is used.

Examples: &FNDSTR

&CHECK = &FNDSTR FAILED &MSGTEXT
&IF &CHECK NE 0 &THEN +
   &WRITE ALARM=YES DATA=REQUEST FAILED
&SRCH = &FNDSTR N10503 &MSG1 &MSG2 &MSG3

Notes:

More information:

&FNDSTR

&SELSTR

&REMSTR