%SCAN returns the first position of the search argument in the
source string, or 0 if it was not found. If the start position is
specified, the search begins at the starting position. The result
is always the position in the source string even if the starting position
is specified. The starting position defaults to 1.
The first parameter must be of type character, graphic, or
UCS-2. The second parameter must be the same type as the first
parameter. The third parameter, if specified, must be numeric with
zero decimal positions.
When any parameter is variable in length, the values of the other
parameters are checked against the current length, not the maximum
length.
The type of the return value is unsigned integer. This built-in
function can be used anywhere that an unsigned integer expression
is valid.
If the search argument contains trailing blanks, the
scan will include those trailing blanks. For example if 'b' represents
a blank, %SCAN('12b':'12312b') would return 4. If trailing blanks
should not be considered in the scan, use %TRIMR on the search argument.
For example %SCAN(%TRIMR('12b'):'12312b') would return 1.
Note: Unlike the SCAN operation code, %SCAN cannot return
an array containing all occurrences of the search string and its results
cannot be tested using the %FOUND built-in function.