z/OS TSO/E REXX Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


ARG

z/OS TSO/E REXX Reference
SA32-0972-00

Read syntax diagramSkip visual syntax diagram
>>-ARG-+---------------+-;-------------------------------------><
       '-template_list-'     

ARG retrieves the argument strings provided to a program or internal routine and assigns them to variables. It is a short form of the instruction:
Read syntax diagramSkip visual syntax diagram
>>-PARSE UPPER ARG-+---------------+-;-------------------------><
                   '-template_list-'     

The template_list is often a single template but can be several templates separated by commas. If specified, each template is a list of symbols separated by blanks or patterns or both.

Unless a subroutine or internal function is being processed, the strings passed as parameters to the program are parsed into variables according to the rules described in Parsing.

If a subroutine or internal function is being processed, the data used will be the argument strings that the caller passes to the routine.

In either case, the language processor translates the passed strings to uppercase (that is, lowercase az to uppercase AZ) 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 string or strings (typically with different templates). The source string does not change. The only restrictions on the length or content of the data parsed are those the caller imposes.

Example:
/* String passed is "Easy Rider"  */

Arg adjective noun .

/* Now:  ADJECTIVE  contains 'EASY'           */
/*       NOUN       contains 'RIDER'          */

If you expect more than one string 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:
/* 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'                  */
Note:
  1. The ARG built-in function can also retrieve or check the argument strings to a REXX program or internal routine. See ARG (Argument).
  2. The source of the data being processed is also made available on entry to the program. See PARSE for details.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014