t or T trims trailing blanks from the string and charlist arguments. If you
want to remove trailing blanks from only one character argument
instead of both character arguments, then use the TRIM function
instead of the %SCAN function with the T modifier.
u or U adds uppercase letters to the list of characters.
w or W adds printable (writable) characters to the list of characters.
x or X adds hexadecimal characters to the list of characters.
Tip
If the modifier argument is a character constant, then enclose it in quotation
marks. Specify multiple modifiers in a single set of quotation marks. A
modifier argument can also be expressed as a character variable or expression.
Details
The %SCAN and %QSCAN functions search argument and return the nth word. A word
is one or more characters separated by one or more delimiters.
%SCAN does not mask special characters or mnemonic operators in its result, even
when the argument was previously masked by a macro quoting function. %QSCAN
masks the following special characters and mnemonic operators in its result:
& % ' " ( ) + − * / < > = ¬ ^ ~ ; , # blank
AND OR NOT EQ NE LE LT GE GT IN
Definition of “Delimiter” and “Word”
A delimiter is any of several characters that are used to separate words. You can specify
the delimiters in the charlist and modifier arguments.
If you specify the Q modifier, then delimiters inside substrings that are enclosed in
quotation marks are ignored.
In the %SCAN function, “word” refers to a substring that has all of the following
characteristics:
• is bounded on the left by a delimiter or the beginning of the string
• is bounded on the right by a delimiter or the end of the string
• contains no delimiters
A word can have a length of zero if there are delimiters at the beginning or end of the
string, or if the string contains two or more consecutive delimiters. However, the
%SCAN function ignores words that have a length of zero unless you specify the M
modifier.
Using Default Delimiters in ASCII and EBCDIC Environments
If you use the %SCAN function with only two arguments, then the default delimiters
depend on whether your computer uses ASCII or EBCDIC characters.
• If your computer uses ASCII characters, then the default delimiters are as follows:
blank ! $ % & ( ) * + , - . / ; < ^¦
In ASCII environments that do not contain the ^ character, the %SCAN function uses
the ~ character instead.
• If your computer uses EBCDIC characters, then the default delimiters are as follows:
blank ! $ % & ( ) * + , - . / ; < ¬ | ¢¦
270 Chapter 17 • Macro Functions