RPG – %SCAN

The %SCAN built-in function is used to find the start position of the search argument in a string.

If the the search argument isn’t found in the string, result is 0.

%SCAN parameters:

  1. Search argument
  2. Source string to search
  3. Start position for the scan (optional, default 1)
  4. Length to scan (optional, default the length of the source string)

Example