I said "useful" tricks, knowing that CLIST has its own list of specialty items.
Maybe "important" would have been a better word; it's what I was thinking. It
isn't hard to get REXX to complain if certain arguments aren't provided; I
usually do it like this:
acid=''
arg args; do while args<>''; parse var args arg args; select
when arg='DBG' then trace 'I' /* trace mode */
when tgetacid(arg)=0 then acid=arg /* set the ACID */
otherwise call abend arg'?','Unrecognized arg' arg; end; end
if acid='' then call abend 'No ACID!',"You're supposed to supply an ACID",
'for me to work with.'
Of course, importance is in the eye of the beholder. But I gave only honorable
mention to CLIST's very convenient argument parser; this doesn't make the cut,
in my beholding.
---
Bob Bridges, [email protected], cell 336 382-7313
/* I never noticed them actually using English words in the finals of the
spelling bee. They seem to have reached a point where the spellers can spell
all the English words and have moved on to words from around the world that may
once have been used in an English sentence. -Dogsbody at Norton's Patrick
O'Brian forum */
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf
Of David Spiegel
Sent: Sunday, March 22, 2020 14:30
How about the ability to force the caller to supply a specific number of
arguments?
--- On 2020-03-22 14:27, Bob Bridges wrote:
> As far as I know there are only two useful tricks CLIST can perform that REXX
> can't. Well, maybe three:
>
> 1) WRITENR. So when I really need it, I use an external REXX exec named
> SAYNR that does the same thing - by calling a CLIST that does a WRITENR.
> Works like a champ, but I wouldn't want to try it inside a loop.
>
> 2) Interacting with subsystems. In CLIST you can issue FTP commands, for
> example, evaluate the response and decide where to go from there; REXX
> handles subsystems as batch, essentially.
>
> 3) Dunno whether you'd count this, but CLIST has a neat built-in
> functionality for evaluating parms. I get around this by starting every REXX
> with a SELECT statement that evaluates each space-delimited word in the arg
> list; it's more complicated, but it means that in most cases I can enter
> arguments in any order, which pleases me. Like this (to pick a complex
> example with many possible arguments):
>
> fnox=0; fall=0; acid=''; ddnfm=''; ddnto=''
> arg args; do while args<>''; parse var args arg args; select
> when arg='DBG' then trace 'I' /* trace mode */
> when arg='NOX' then fnox=1 /* no-execute mode */
> when abbrev('LISTALL',arg,5) then fall=1 /* turn on list-all mode
> */
> when pos('.',arg)>0 then dsn=arg /* set the DSN */
> when tgetacid(arg)=0 then acid=arg /* set the ACID */
> when length(arg)<9 & ddnfm='' then ddnfm=arg /* from DD */
> when length(arg)<9 & ddnto='' then ddnto=arg /* to DD */
> otherwise call abend 'Unrecognized arg' arg; end; end
>
> The only requirement here regarding argument order is that the From DD has to
> be named before the To DD; everything else the operator can type in as it
> happens to occur to him.
>
> This makes my REXX execs a little messy up front, but gives me flexibility
> that I value. And anyway I'm used to it now. Easily worth the extra trouble
> to get access to the power REXX affords over CLIST. Too bad about #2, though.
>
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:[email protected]] On
> Behalf Of CM Poncelet
> Sent: Friday, March 20, 2020 20:39
>
> Clist can allocate variable names dynamically, using &'s, and can then
> use SYSSCAN to control how many &'s are interpreted. Its problem is it
> cannot ADDRESS environments and cannot process binary data, which REXX can.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN