On 2017-05-03, at 12:30, Alan Altmark wrote:

> On Wednesday, 05/03/2017 at 03:47 GMT, Paul Gilmartin (π) 
> <paulgboul...@aim.com> wrote:
>> Rexx's CALL instruction provides no way to indicate a null
>> last argument.
> 
> CALL XYZ "fun", , "flags", ""
> XYZ: ARG p1, p2, p3, p4
> 
> will provide a null string (length 0) to to both "p2" and "p4" the 
> routine.  You can get away without the trailing "" but only if the next 
> line is empty.  (Or...."How to make debug more challenging!")
> 
> I have pretty much abandoned CALL in CMS in favor of function calls with 
> null return values.  The REXX interface to CMS (REXEXT macro) suppresses 
> any null command, so I can get more creative in the way I call functions
>   
This once caused me a problem.  I had crafted a command environment to
which the null string was a meaningful command.  But Rexx suppressed it.
I went to SR, and IBM fixed it (the Reference Manual made no exception
for the null string as a command.)  But IBM said it remains suppressed
for ADDRESS CMS, ADDRESS COMMAND, and ADDRESS XEDIT.

> without resorting to syntax crutches like the ones above.  It ensures that 
> there is never ambiguity in the purpose of a trailing comma.
>  
But, I can't provide an "OMITTED" final argument, no matter how
many commas or blank lines I supply.  (Example not with IBM's
Rexx, but I believe it works the same:
/* Rexx *************** */ signal on novalue  /*
   null final argment?
*/
trace R

X =  XYZ( "fun", , "flags", "", , , , )
call XYZ  "fun", , "flags", "", , , ,

return( 0 )

XYZ: procedure
    trace N
    say arg()
    do I = 1 to arg()
        say I':' arg( I, 'E' ) arg( I );  end I
    say
    return( 0 )
/* ******************** */ 

     6 *-* X =  XYZ( "fun", , "flags", "", , , , )
    11 *-*  procedure
    12 *-*  trace N
4
1: 1 fun
2: 0 
3: 1 flags
4: 1 

     7 *-* call XYZ  "fun", , "flags", "", , ,  
    11 *-*  XYZ:
       *-*  procedure
    12 *-*  trace N
4
1: 1 fun
2: 0 
3: 1 flags
4: 1 

     9 *-* return( 0 )

-- gil

Reply via email to