For brevity, if you don't like DO END.

 select
    when idx="T" then countt=countt+1
    when idx="U" then countu=countu+1
    when idx="V" then countv=countv+1
    when idx="W" then countw=countw+1
    otherwise         countx=countx+1; end

Could be :
SELECT( idx)
    when ("T") then countt=countt+1
    when ("U") then countu=countu+1
    when ("V") then countv=countv+1
    when ("W") then countw=countw+1
    otherwise         countx=countx+1; end



On Mon, Jun 8, 2020 at 2:08 PM Bob Bridges <robhbrid...@gmail.com> wrote:

> No, I wasn't complaining about the SELECT statement, only about using lots
> of DO/statement/ENDs when there's only a single statement.  I would code
> the same thing like this:
>
>   select
>     when idx="T" then countt=countt+1
>     when idx="U" then countu=countu+1
>     when idx="V" then countv=countv+1
>     when idx="W" then countw=countw+1
>     otherwise         countx=countx+1; end
>
> (Of course if that were a real example I would probably have found a way
> to use a stem variable instead:
>
>   count.idx=count.idx+1
>
> But in this case I was just talking about coding style, as Mr Metz said.)
>
> ---
> Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313
>
> /* If a problem has a single neck, it has a simple solution. */
>
> -----Original Message-----
> From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> Behalf Of Lou Losee
> Sent: Sunday, June 7, 2020 14:38
>
> Would you rather code the select as a series of nested if-then-else?
>
> --- On Sun, Jun 7, 2020 at 1:35 PM Bob Bridges <robhbrid...@gmail.com>
> wrote:
> > The only language I can think of off-hand that doesn't require some sort
> > of END to close a DO (I'm sure there are others) is ISPF.  But, in REXX
> at
> > least, I never use single-statement DOs.  I see them all the time, and I
> > don't get it.  Like this:
> >
> >   if x=0 then do
> >     x=x+1
> >   end
> >
> > Or, more painfully:
> >
> >   select
> >     when idx="T" then
> >       do
> >         countt=countt+1
> >       end
> >     when idx="U" then
> >       do
> >         countu=countu+1
> >       end
> >     when idx="V" then
> >       do
> >         countv=countv+1
> >       end
> >     when idx="W" then
> >       do
> >         countw=countw+1
> >       end
> >     otherwise
> >       do
> >         countx=countx+1
> >       end
> >   end
> >
> > Why?  If it were easier to read, I might sympathize.  But it's harder,
> not
> > easier.
> >
> > -----Original Message-----
> > From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
> > Behalf Of Paul Gilmartin
> > Sent: Saturday, June 6, 2020 14:40
> >
> > But in Rexx similarly, END is required even for a single-statement DO.
> > Good for Rexx.  I like strong closure.
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
>


-- 
Wayne V. Bickerdike

----------------------------------------------------------------------
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