>>-ARG--+---------------+--;-----------------------------------><
+-template_list-+
ARG retrieves the argument strings provided to a program, internal routine, or method and assigns them to variables. It is a short form of the instruction:
>>-PARSE UPPER ARG--+---------------+--;-----------------------><
+-template_list-+
The template_list can be a single template or list of templates separated by commas. Each template consists of one or more symbols separated by whitespace characters, patterns, or both.
The objects passed to the program, routine, or method are converted to string values and parsed into variables according to the rules described in
Chapter 9, Parsing.
The language processor converts the objects to strings and translates the strings to uppercase (that is, lowercase a
-z
to uppercase A
-Z
) before processing them. Use the PARSE ARG instruction if you do not want uppercase translation.
You can use the ARG and PARSE ARG instructions repeatedly on the same source objects (typically with different templates). The source objects do not change.
Example 2.5. Instructions - ARG
/* String passed is "Easy Rider" */
Arg adjective noun .
/* Now: ADJECTIVE contains "EASY" */
/* NOUN contains "RIDER" */
If you expect more than one object to be available to the program or routine, you can use a comma
in the parsing
template_list so each template is selected in turn.
Example 2.6. Instructions - ARG
/* Function is called by FRED("data X",1,5) */
Fred: Arg string, num1, num2
/* Now: STRING contains "DATA X" */
/* NUM1 contains "1" */
/* NUM2 contains "5" */
Notes:
The USE ARG instruction (see
Section 2.30, “USE”) is an alternative way of retrieving arguments. USE ARG performs a direct, one-to-one assignment of argument objects to Rexx variables. You should use this when your program needs a direct reference to the argument object, without string conversion or parsing. ARG and PARSE ARG produce string values from the argument objects, and the language processor then parses the string values.