Please enable JavaScript to view this site.
This program will scan the String passed in PARM1 for the Pattern supplied in PARM2.
Parameter |
In |
Len |
Out |
Len |
PARM1 |
String |
132 |
Pattern start position #2 |
3 |
PARM2 |
Pattern |
132 |
- |
|
PARM3 |
Translate [*YES] #1 |
4 |
- |
|
PARM4 |
Whole word [*YES] #3 |
4 |
- |
|
PARM5 |
- |
|
- |
|
PARM6 |
- |
|
- |
|
#1 | the scan function will be case sensitive unless you specify *YES in PARM3 in which case the string [PARM1] will be converted to uppercase before matching with the pattern. |
It follows that if you specify *YES in PARM3 then your pattern should be entered in uppercase in order to find a result.
#2 the result returned in PARM1 will be ‘000’ if:
•No match was found
•The Pattern length is longer than the String length
•The String is blank
•The Pattern is blank
Otherwise the result returned is the position of the first character of the pattern in the string e.g. 028.
#3 the scan function will search for the pattern with an assumed leading and trailing blank.
E.g.
String = Here we go again, the aga is playing up.
Pattern = aga [with a leading space]
If you specify *YES in PARM4 then the Pattern start position returned will be 023 [for aga], if blank then it will be 012 [for again].