3.2.4. ARG([argno[,option]])

Returns information about the arguments of the current procedure
level. For subroutines and functions it will refer to the
arguments with which they were called. For the “main” program it
will refer to the arguments used when the REXX interpreter was
called.

Note that under some operating systems, REXX scripts are run by
starting the REXX interpreter as a program, giving it the name of
the script to be executed as parameter. Then the REXX interpreter
might process the command line and “eat” some or all of the
arguments and options.  Therefore, the result of this function at
the main level is implementation dependent.  The parts of the
command line which are not available to the REXX script might for
instance be the options and arguments meaningful only to the
interpreter itself.

Also note that how the interpreter on the main level divides the
parameter line into individual arguments, is implementation
dependent.  The standard seems to define that the main procedure
level can only get one parameter string, but don’t count on it.

For more information on how the interpreter processes arguments
when called from the operating system, see the documentation on
how to run a REXX script.

When called without any parameters, ARG() will return the number
of comma-delimited arguments. Unspecified (omitted) arguments at
the end of the call are not counted. Note the difference between
using comma and using space to separate strings.  Only comma-
separated arguments will be interpreted by REXX as different
arguments.  Space-separated strings are interpreted as different
parts of the same argument.

Argno must be a positive whole number. If only argno is specified,
the argument specified will be returned. The first argument is
numbered 1. If argno refers to an unspecified argument (either
omitted or argno is greater than the number of arguments), a
nullstring is returned.

If option is also specified, the return value will be 1 or 0,
depending on the value of option and on whether the numbered
parameter was specified or not. Option can be:

[O]
     (Omitted) Returns 1 if the numbered argument was omitted or
     unspecified. Otherwise, 0 is returned.

[E]
     (Existing) Returns 1 if the numbered argument was specified,
     and 0 otherwise.

If called as:

     CALL FUNCTION ‘This’ ‘is’, ‘a’,, ‘test’,,


      ARG()    –>   4  /*Last parameter omitted */
      ARG(1)   –>   ‘This is’
      ARG(2)   –>   ‘a’
      ARG(3)   –>   ‘’
      ARG(9)   –>   ‘’  /*Ninth parameter nonexisting */
      ARG(2,’E’)    –>   1
      ARG(2,’O’)    –>   0
      ARG(3,’E’)    –>   0  /*Third parameter omitted */
      ARG(9,’O’)    –>   1



PREV NEXT