Discussion:
Rexx calls versus branching
(too old to reply)
Bill Giannelli
2019-09-30 13:38:36 UTC
Permalink
I am still learning Rexx. Can someone give a simple example of 1) calling a routine and returning. 2) branching to a routine without returning.
I have a SELECT statement and from the last where clause I want to branch to a routine without returning. But it keeps returning and falling thru the end of the SELECT statement.
thanks
Bill

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Brian Chapman
2019-09-30 13:54:30 UTC
Permalink
Bill,

Rexx is a procedural language. Calls to a subroutine that end with a RETURN
statement will always branch back to the calling routine. Rexx has the
SIGNAL statement that behaves like a GOTO, but it is mostly intended to be
used for error handling. If you want the program to terminate after calling
the subroutine, replace the RETURN statement with EXIT(0).



Thank you,

Brian Chapman
Post by Bill Giannelli
I am still learning Rexx. Can someone give a simple example of 1) calling
a routine and returning. 2) branching to a routine without returning.
I have a SELECT statement and from the last where clause I want to branch
to a routine without returning. But it keeps returning and falling thru the
end of the SELECT statement.
thanks
Bill
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Seymour J Metz
2019-10-01 20:17:43 UTC
Permalink
Alas, SIGNAL does not behave like a goto, and it will bite you if you try to use it as one. Using it for anything other than handling fatal errors is asking for trouble. But it's not my dog.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-***@LISTSERV.UA.EDU> on behalf of Brian Chapman <***@GMAIL.COM>
Sent: Monday, September 30, 2019 9:54 AM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: Rexx calls versus branching

Bill,

Rexx is a procedural language. Calls to a subroutine that end with a RETURN
statement will always branch back to the calling routine. Rexx has the
SIGNAL statement that behaves like a GOTO, but it is mostly intended to be
used for error handling. If you want the program to terminate after calling
the subroutine, replace the RETURN statement with EXIT(0).



Thank you,

Brian Chapman
Post by Bill Giannelli
I am still learning Rexx. Can someone give a simple example of 1) calling
a routine and returning. 2) branching to a routine without returning.
I have a SELECT statement and from the last where clause I want to branch
to a routine without returning. But it keeps returning and falling thru the
end of the SELECT statement.
thanks
Bill
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Bill Giannelli
2019-09-30 14:10:16 UTC
Permalink
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 ***@listserv.ua.edu with the message: INFO IBM-MAIN
Lionel B Dyck
2019-09-30 14:13:44 UTC
Permalink
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-***@LISTSERV.UA.EDU> On Behalf Of Bill Giannelli
Sent: Monday, September 30, 2019 9:10 AM
To: IBM-***@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 ***@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
scott Ford
2019-09-30 18:05:42 UTC
Permalink
Bill,

What Lionel illustrated is how I make calls in Rexx also. The call can also
be an external Rexx program residing in the same PDS.

Scott
Post by Lionel B Dyck
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.
/* rexx */
call code 0 100
exit
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-----
Sent: Monday, September 30, 2019 9:10 AM
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
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
--
Scott Ford
IDMWORKS
z/OS Development

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Frank Swarbrick
2019-09-30 23:25:06 UTC
Permalink
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-***@LISTSERV.UA.EDU> on behalf of Lionel B Dyck <***@GMAIL.COM>
Sent: Monday, September 30, 2019 8:13 AM
To: IBM-***@LISTSERV.UA.EDU <IBM-***@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-***@LISTSERV.UA.EDU> On Behalf Of Bill Giannelli
Sent: Monday, September 30, 2019 9:10 AM
To: IBM-***@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 ***@listserv.ua.edu with the message: INFO IBM-MAIN

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

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Seymour J Metz
2019-10-01 20:37:37 UTC
Permalink
I would say that it always works, but that it is easy to get confused and forget how you coded the procedure when writing the call. Comments don't cost much.

--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-***@LISTSERV.UA.EDU> on behalf of Frank Swarbrick <***@OUTLOOK.COM>
Sent: Monday, September 30, 2019 7:24 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: Rexx calls versus branching

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-***@LISTSERV.UA.EDU> on behalf of Lionel B Dyck <***@GMAIL.COM>
Sent: Monday, September 30, 2019 8:13 AM
To: IBM-***@LISTSERV.UA.EDU <IBM-***@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://secure-web.cisco.com/1WdBDU2cdrRZIYOV8-isbD85T8ttm0-aynccUDdjwbuNeOheTg1N_gtEdQGCR9iEEvhmmr05WN5BsJkokKKsJhOBhPG_QC3aY1Ku7MnqyJlwdSiGkVMuOiMOKroIT9tMkYHmiYm39lk516urvpYB0hKiyYydVYaQfZzEtFJe7o_zLGzOHcCfVkBDVQjFGa-tuQCF3u5lg0oZXrkVBSgjmKK43UyRy1ABv3X-IwPqMsgz6s4RET8cqIYeHhRF7o3vfESz4VK0SUQPoF-1IeQm3c9Mu4X3S3bC0IVm3Fd7gE4DErrD8rZIP8_JB5XpyZFDmfXFD06_1act13p-mdh8C6YpeaEUpxfTrPMQ3jwEAdt5ZgzlIVEwLu55uHOxg2v2cRdNDvMMkj4wYHunVUStE_4Trr3rThis1mCy61YIxzBFye5cUsOi_R8qbDz0Ur5EW/http%3A%2F%2Fwww.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-***@LISTSERV.UA.EDU> On Behalf Of Bill Giannelli
Sent: Monday, September 30, 2019 9:10 AM
To: IBM-***@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 ***@listserv.ua.edu with the message: INFO IBM-MAIN

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

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


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Seymour J Metz
2019-10-01 20:22:38 UTC
Permalink
Not quite; 'CALL CODE 0 100' passes a single parameter.

'arg one two' is equivalent to 'parse upper arg one two', which in turn is equivalent to
'parse upper value arg(1) one two'. Contrast this with 'CALL CODE 0, 100' and
'arg one, two'.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-***@LISTSERV.UA.EDU> on behalf of Lionel B Dyck <***@GMAIL.COM>
Sent: Monday, September 30, 2019 10:13 AM
To: IBM-***@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://secure-web.cisco.com/1K2y2zIYIZOSsfxjovxy7V2IqxAu9U96C7eqnr4zGc6NYResqrJkrmc7RR6vtVJT9TW1kuqQ9DBLw8dTMLtC_V7387tdudG27oSUU0SYNAz_3sclE-lMDMSkMq-WRCEpjnJHKPrnuqsf8h5yqMx4mt40iJXE324OuyuAH9MVpyM0bgZPc9kunYhmTrHXRKoi2BV3Ba-1J9unu2A6y1yXLMc_s9zQJaqcQFOzO8UWrHK7F99ctb7PnuLglFjzuu1iEXa8hBBdm5-uKgjhbA4UvE9vrJF_ASRua_ERmEJVye3WzC5Eh0Z8vYESx42Y24BMc7YkVYh12w6YB7Qi_zB0HrtyMzc9wQ4Z2BMS0oejpUKTkY9AQ0JB-rJ4cMrzpjXHU_62OTvzvrr2qNYGTv0K-fSBYpMEUQVMLXy_U7sUzrxUmtlEjVm_AoJDjpnBUUGZb/http%3A%2F%2Fwww.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-***@LISTSERV.UA.EDU> On Behalf Of Bill Giannelli
Sent: Monday, September 30, 2019 9:10 AM
To: IBM-***@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 ***@listserv.ua.edu with the message: INFO IBM-MAIN

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


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Seymour J Metz
2019-10-01 20:26:40 UTC
Permalink
The first call passes '0' and the second call passes '0 100'; that may or may not be what you want. If the routine actually expects two parameters, then you must code 'call code 0, 100'.

As for error handling, REXX does not have a branch instruction. It does have signal, which does some nasty things if you try using it for anything but the error handling it is intended for.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-***@LISTSERV.UA.EDU> on behalf of Bill Giannelli <***@GMAIL.COM>
Sent: Monday, September 30, 2019 10:10 AM
To: IBM-***@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 ***@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Phil Smith III
2019-09-30 17:24:57 UTC
Permalink
Post by Bill Giannelli
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?
Lionel (correctly, of course) noted that there's nothing special about this. I'd add that this is a semi-hack to allow passing parameters to the error handler. For example, you might have code like this:



'some command'

if rc <> 0 then signal SomeCommandFailed



'another command a'

if rc <> 0 then call AnotherCommandFailed 'a'





'another command b'

if rc <> 0 then call AnotherCommandFailed 'b'



...



SomeCommandFailed: /* Reached via SIGNAL */

say 'The SOME command failed'

exit rc



AnotherCommandFailed: /* Reached via CALL */

arg why

say 'The ANOTHER command failed on the' why 'call.'

exit rc



This is a pretty hokey example, obviously, but I've seen both techniques used a lot. The SomeCommandFailed handler could also be CALLed with no parameters, but one of the advantages of SIGNAL is that because it's *not* a CALL and you know it's not going to RETURN, someone new (or you, six days/weeks/months/years later) reading the mainline can draw some conclusions from it in trying to understand that mainline. I'm a strong advocate of using it for error handlers that aren't going to return for this reason. It's also more efficient, since it's not saving state over the call, although these days we mostly don't worry about that so much.



This makes SIGNAL kind of a Rexx idiom, because it's not really a GOTO, although it plays one on TV. Just don't do this please:



signal SomeLabel

ReturnFromSomeLabel:

...



SomeLabel:

<code>

signal ReturnFromSomeLabel



Now that would be ugly. And to a Rexx programmer, Just Plain Wrong.



.phsiii



P.S. I'd also never call a subroutine CODE simply because it's too common a word-too hard to find references to it. Use names like the above!




----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Paul Gilmartin
2019-09-30 18:22:19 UTC
Permalink
Post by Bill Giannelli
I am still learning Rexx. Can someone give a simple example of 1) calling a routine and returning. 2) branching to a routine without returning.
I have a SELECT statement and from the last where clause I want to branch to a routine without returning. But it keeps returning and falling thru the end of the SELECT statement.
thanks
You may get more narrowly target information by subscribing at:
http://vm.marist.edu/htbin/wlvindex?TSO-REXX

Please post a brief example of what you're trying and describe
what you want to happen.

Is the routine you mention internal or external? Are you free to
modify it?

If you do not want it to fall thru the end of the SELECT statement,
where do you want it to go? I t must go somewhere.

Like others, I do not recommend SIGNAL for this purpose.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Bill Giannelli
2019-09-30 18:48:19 UTC
Permalink
My statement is as follows:
SELECT
WHEN ssid = "XXXX" THEN grp = "ZZZZ"

WHEN ssid = " " THEN say 'subsystem not entered';
call code
OTHERWISE
NOP
END

I thought it was falling though when SSID was blank.
But what I neglected was a null value for SSID.
Thanks
Bill

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Charles Mills
2019-09-30 21:09:22 UTC
Permalink
Rexx is pretty easy to learn. Googling <Rexx Tutorial> gives me lots of hits.

I'm not putting you down for asking here. It's just that a couple of hours of tutorial might be better and easier for you than a bunch of scattershot questions here.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On Behalf Of Bill Giannelli
Sent: Monday, September 30, 2019 11:48 AM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: Rexx calls versus branching

My statement is as follows:
SELECT
WHEN ssid = "XXXX" THEN grp = "ZZZZ"

WHEN ssid = " " THEN say 'subsystem not entered';
call code
OTHERWISE
NOP
END

I thought it was falling though when SSID was blank.
But what I neglected was a null value for SSID.
Thanks
Bill

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

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Seymour J Metz
2019-10-01 20:29:05 UTC
Permalink
There are two problems with that code. The first is that you have a WHEN followed by two statements; you need to put them inside a DO/END pair. The second is that you need to use == in order to distinguish '' from ' '.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-***@LISTSERV.UA.EDU> on behalf of Bill Giannelli <***@GMAIL.COM>
Sent: Monday, September 30, 2019 2:48 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: Rexx calls versus branching

My statement is as follows:
SELECT
WHEN ssid = "XXXX" THEN grp = "ZZZZ"

WHEN ssid = " " THEN say 'subsystem not entered';
call code
OTHERWISE
NOP
END

I thought it was falling though when SSID was blank.
But what I neglected was a null value for SSID.
Thanks
Bill

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

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Paul Gilmartin
2019-09-30 19:28:54 UTC
Permalink
Post by Bill Giannelli
SELECT
WHEN ssid = "XXXX" THEN grp = "ZZZZ"
WHEN ssid = " " THEN say 'subsystem not entered';
call code
OTHERWISE
NOP
END
I thought it was falling though when SSID was blank.
But what I neglected was a null value for SSID.
My refactoring; my personal style:

SIGNAL ON NOVALUE /* Strongly recommended to trap unassigned variables. */

ssid = " " /* or something else to test. */

SELECT
WHEN ssid = "XXXX" THEN grp = "ZZZZ"

/* Use "==" for literal comparison.
*/
WHEN ssid = "XXXX" THEN grp = "ZZZZ"

WHEN ssid= = " " THEN
DO blank_ssid = 42 until 1
say 'subsystem not entered';
call code
RETURN /* In order not to fall through. */
END blank_ssid /* Label DO for legibility. */
OTHERWISE
NOP
END

code: PROCEDURE EXPOSE ssid
SAY "code was called when ssid = """ssid""""
RETURN

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Seymour J Metz
2019-10-01 20:34:15 UTC
Permalink
Your code doesn't do what he was apparently trying to do., due to the loop and the RETURN.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-***@LISTSERV.UA.EDU> on behalf of Paul Gilmartin <0000000433f07816-dmarc-***@LISTSERV.UA.EDU>
Sent: Monday, September 30, 2019 3:28 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: Rexx calls versus branching
Post by Bill Giannelli
SELECT
WHEN ssid = "XXXX" THEN grp = "ZZZZ"
WHEN ssid = " " THEN say 'subsystem not entered';
call code
OTHERWISE
NOP
END
I thought it was falling though when SSID was blank.
But what I neglected was a null value for SSID.
My refactoring; my personal style:

SIGNAL ON NOVALUE /* Strongly recommended to trap unassigned variables. */

ssid = " " /* or something else to test. */

SELECT
WHEN ssid = "XXXX" THEN grp = "ZZZZ"

/* Use "==" for literal comparison.
*/
WHEN ssid = "XXXX" THEN grp = "ZZZZ"

WHEN ssid= = " " THEN
DO blank_ssid = 42 until 1
say 'subsystem not entered';
call code
RETURN /* In order not to fall through. */
END blank_ssid /* Label DO for legibility. */
OTHERWISE
NOP
END

code: PROCEDURE EXPOSE ssid
SAY "code was called when ssid = """ssid""""
RETURN

-- gil

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

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
w***@gmail.com
2019-09-30 21:08:12 UTC
Permalink
" The call can also be an external Rexx program residing in the same PDS. "
Not true, it may be anywhere within the libraries allocated to the SYSEXEC or SYSPROC concatenations.
Phil Smith III
2019-10-01 03:21:01 UTC
Permalink
Frank Swarbrick wrote about passing parameters.


Yes, exactly correct. And not really surprising when you think about it, but it could indeed bite a newbie!


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Charles Mills
2019-10-01 15:39:14 UTC
Permalink
In most languages a coding error of

Foo [some syntactic element inadvertently omitted here] Bar

Is a syntax error. For example, in C, x = foo bar; /* supposed to be foo +
bar */

But in Rexx, Foo Bar is often syntactically correct and is equivalent to Foo
|| " " || Bar

One person's feature is another person's trap for the unwary.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On
Behalf Of Phil Smith III
Sent: Monday, September 30, 2019 8:21 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: Rexx calls versus branching

Frank Swarbrick wrote about passing parameters.


Yes, exactly correct. And not really surprising when you think about it, but
it could indeed bite a newbie!

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Seymour J Metz
2019-10-01 20:39:51 UTC
Permalink
For most languages that is only true for some syntactic elements.

'x := -;'

'x := y;'


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-***@LISTSERV.UA.EDU> on behalf of Charles Mills <***@MCN.ORG>
Sent: Tuesday, October 1, 2019 11:38 AM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: Rexx calls versus branching

In most languages a coding error of

Foo [some syntactic element inadvertently omitted here] Bar

Is a syntax error. For example, in C, x = foo bar; /* supposed to be foo +
bar */

But in Rexx, Foo Bar is often syntactically correct and is equivalent to Foo
|| " " || Bar

One person's feature is another person's trap for the unwary.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-***@LISTSERV.UA.EDU] On
Behalf Of Phil Smith III
Sent: Monday, September 30, 2019 8:21 PM
To: IBM-***@LISTSERV.UA.EDU
Subject: Re: Rexx calls versus branching

Frank Swarbrick wrote about passing parameters.


Yes, exactly correct. And not really surprising when you think about it, but
it could indeed bite a newbie!

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

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to ***@listserv.ua.edu with the message: INFO IBM-MAIN
Seymour J Metz
2019-10-01 20:15:29 UTC
Permalink
REXX does not have a goto statement. You will sometimes read that SIGNAL is a goto; that's not only wrong but dangerous for those who believe it.

The EXIT statement can be used by an internal routine to terminate the entire program containing it, but not the caller of that program. See also LEAVE and ITERATE.

If you can find a dead tree or PDF copy of "Learning REXX in 21 days", that's a good starting point. Also, <http://www.rexxla.org/Newsletter/9812safe.html> and <http://www.rexxla.org/Newsletter/9901safe.html> mention some pitfalls for the beginner.


--
Shmuel (Seymour J.) Metz
http://mason.gmu.edu/~smetz3


________________________________________
From: IBM Mainframe Discussion List <IBM-***@LISTSERV.UA.EDU> on behalf of Bill Giannelli <***@GMAIL.COM>
Sent: Monday, September 30, 2019 9:28 AM
To: IBM-***@LISTSERV.UA.EDU
Subject: Rexx calls versus branching

I am still learning Rexx. Can someone give a simple example of 1) calling a routine and returning. 2) branching to a routine without returning.
I have a SELECT statement and from the last where clause I want to branch to a routine without returning. But it keeps returning and falling thru the end of the SELECT statement.
thanks
Bill

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