SCAN


ANSI

 

The SCAN instruction searches a character string for the source string. It optionally supports usage of a don't care/wild card character for the search. The instruction uses the following format:

 

[label]

SCAN

{source}{sep}{dest}[,NOCASE[=(nocase}]]:

 

 

[WILDCARD={wildcard}][,GETFP={destfp}]

 

Where:

label

Optional. A Program Execution Label.

source

Required. A previously defined Character String Variable, National Character String Variable, or Literal that is found in the {dest} variable.

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 which {source} is searched.

wildcard

Optional. A previously defined Character String Variable, National Character String Variable, or single character literal indicating characters treated as wildcard values.

nocase

Optional. A previously defined Numeric variable, decimal number, or numeric expression.

destfp

Optional. A previously defined Numeric Variable that receives the form pointer of {dest} operand vatiable where the source string is found.

 

Flags Affected: EOS, EQUAL

Note the following:

  1. Only the Logical String contents of the {source} and {dest} are compared.

  2. Neither the {source} nor {wildcard} character are changed.

  3. If the Logical String of the {source} is longer than the Logical String of {dest}, no match is found.

  4. If a match is found, the following actions occur:

  5. If either operand is a Null String, the EOS Condition Flag is set.

  6. The optional {wildcard} parameter specifies a character that is treated as a don't care character. If the specified character exists in the {source} operand, it matches any character in the {dest} operand that occupies the same relative position. If {wildcard} is a string variable, the Form Pointed character is used.

  7. The NOCASE keyword without an operand enables case insensitive scanning. If the 'NOCASE={dnumnvar}' syntax is used, a numeric value of zero turns insensitive scanning off. If the operand is a non-zero value, the insensitive scanning is turned on.

  8. Mixing NCHAR/NLITERAL and DIM/LITERAL data types is not allowed for the {source}, {dest}, and {wildcard} operands. Otherwise,an appropriate compiler error is generated.

 

 

See Also: Example Code, SEARCH, Character String Instructions

 



PL/B Language Reference RESET SDELETE