Scanning is performed from left to right and words in the string (leading and trailing blanks excluded) are matched one by one with the variables named in the template. The last variable named in the template will contain the remaining part of the string, including leading and trailing blanks.
Up to 30 variable names can be specified in a parsing template.
The following situations can be encountered:
The number of words in the string matches the number of variables in the template. Each of those variables contains one word of the string. The last variable contains the last word in the string including leading and trailing blanks.
The number of words in the string is smaller than the number of variables named in the template The first variables each contain one word of the string and the extra variables receive a value of NULL (a string of 0 character length).
The number of words in the string is greater than the number of variables in the template All variables but the last one contain one word of the string and the last variable named in the template contains the remaining part of the string, including leading and trailing blanks.
Example
The DO SET statements below (which include a %%$PARSE function)
DO SET=%%S = THIS IS A SAMPLE STRING
DO SET=%%T = A1 A2 A3
DO SET=%%$PARSE %%S %%T
have the same result as the following DO SET statements: