OS/2 Procedures Language 2/REXX


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


ARG




 >>--ARG(-+-------------------+-)-----------><
          +-n--+-----------+--+
               +-,option---+

ARG returns an argument string, or information about the argument strings 
to a program or internal routine. 
If you do not specify a parameter, the number of arguments passed to the 
program or internal routine is returned. 
If only n is specified, the n th argument string is returned. If the 
argument string does not exist, the null string is returned. n must be a 
positive whole number. 
If you specify option, ARG tests for the existence of the n th argument 
string. Valid options (of which only the capitalized letter is significant 
and all others are ignored) are: 
 Exists      Returns 1 if the n th argument exists; that is, if it was 
             explicitly specified when the routine was called. Returns 0 
             otherwise. 
 Omitted     Returns 1 if the nth argument was omitted; that is, if it was 
             not explicitly specified when the routine was called. Returns 
             0 otherwise. 
 
 Here are some examples: 

 /*  following "Call name;" (no arguments) */
 ARG( )        ->    0
 ARG(1)        ->    ''
 ARG(2)        ->    ''
 ARG(1,'e')    ->    0
 ARG(1,'O')    ->    1
 
 /*  following "Call name 'a',,'b';" */
 ARG( )        ->    3
 ARG(1)        ->    'a'
 ARG(2)        ->    ''
 ARG(3)        ->    'b'
 ARG(n)        ->    ''    /* for n>=4 */
 ARG(1,'e')    ->    1
 ARG(2,'E')    ->    0
 ARG(2,'O')    ->    1
 ARG(3,'o')    ->    0
 ARG(4,'o')    ->    1
 
 
 Notes: 
   1. You can retrieve and directly parse the argument strings to a 
      program or internal routine using the ARG or PARSE ARG instructions. 
      
   2. Programs called as commands can have only 0 or 1 argument strings. 
      The program has no argument strings if it is called with the name 
      only and has 1 argument string if anything else (including blanks) 
      is included with the command. 
   3. Programs called by the REXXSTART entry point can have multiple 
      argument strings. 
   

Inf-HTML End Run - Successful