────ARG───────┬────────────┬────;─────────── └──template──┘
ARG is used to retrieve the argument strings provided to a program or internal routine and assign them to variables. It is a short form of the following instruction:
──PARSE UPPER ARG─┬────────────────┬──;─── └────template────┘
Template is a list of symbols separated by blanks or patterns.
Unless a subroutine or internal function is being run, the interpreter reads the arguments given on the program invocation, translates them to uppercase (for example, a lowercase a-z to an uppercase A-Z), and then parses them into variables. Use the PARSE ARG instruction if you do not want uppercase translation.
If a subroutine or internal function is being run, the data used will be the argument strings passed to the routine.
The ARG (and PARSE ARG) instructions can be run as often as desired (typically with different templates) and always parse the same current input strings. There are no restrictions on the length or content of the data parsed except those imposed by the caller.
Example:
/* String passed is "Easy Rider" */ Arg adjective noun /* Now: "ADJECTIVE" contains 'EASY' */ /* "NOUN" contains 'RIDER' */
If more than one string is expected to be available to the program or routine, each can be selected in turn by using a comma in the parsing template.
Example:
/* function is invoked by FRED('data X',1,5) */ Fred: Arg string, num1, num2 /* Now: "STRING" contains 'DATA X' */ /* "NUM1" contains '1' */ /* "NUM2" contains '5' */
Notes:
o