I just wanted to bring up a "gotcha" when passing more than one "parameter".  I 
believe with the example you give below, you are calling the "code" routine 
with one parameter, which has a value of '0 100'.  The "code" routine then uses 
standard REXX PARSE logic to parse the characters before the space in to the 
first field (one) and the remainder (after the space) in to the second field 
(two).

The reason I mention it is because while this "generally works", it's easy to 
misunderstand what its truly doing.  At least it was for me!  This will 
definitely hit you if you are passing in "multi-word strings".  For example:

call codeX 'this is string 1' 'this is string 2'
exit

codeX: procedure
parse arg one two
say 'one:' one
say 'two:' two
return

This gives the following results:
one: this
two: is string 1 this is string 2

On the other hand, the following gives what is probably desired.

call codeX 'this is string 1', 'this is string 2'
exit

codeX: procedure
parse arg one, two
say 'one:' one
say 'two:' two
return

Results:
one: this is string 1
two: this is string 2

Note the use of the comma to separate it into two distinct parameters.  Also 
required on the "parse arg" (also note use of "parse arg" instead of just 
"arg", as the latter is short of "parse upper arg".

Hope this is correct, and helps REXX newbies.  I don't claim to be any sort of 
REXX expert, but I ran in to this in the only "real life" REXX program I've 
ever written (as opposed to "toy" programs).  If its not correct, then someone 
please correct it!

Frank

________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Lionel B Dyck <lbd...@gmail.com>
Sent: Monday, September 30, 2019 8:13 AM
To: IBM-MAIN@LISTSERV.UA.EDU <IBM-MAIN@LISTSERV.UA.EDU>
Subject: Re: Rexx calls versus branching

The 'CALL CODE 0' and 'CALL CODE 0 100' are simply calls to a subroutine with a 
label of code passing arguments of 0 or 0 and 100.  Nothing magic or special.

See same:

/* rexx */
call code 0 100
exit
code:
arg one two
say 'one' one 'two' two
return


Lionel B. Dyck <sdg><
Website: http://www.lbdsoftware.com

"Worry more about your character than your reputation.  Character is what you 
are, reputation merely what others think you are." - John Wooden

-----Original Message-----
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of 
Bill Giannelli
Sent: Monday, September 30, 2019 9:10 AM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: Re: Rexx calls versus branching

Thank you very much for your response.
I also have a Rexx routine that has "call code 0" and call code 0 100"
which seems to branch to a routine "code" for error handling?
how are the 0 and 100 values processed?
thanks
Bill

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions, send email to 
lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to