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--+---------------+--;-----------------------><

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 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.


/* 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.


/* 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"                  */


  1. The ARG built-in function can also retrieve or check the arguments. See ARG (Argument).

  2. The USE ARG instruction (see 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.