You can also use UNTIL to simulate an IF block from which you can LEAVE.  
Otherwise it's difficult, or at least a little complicated.  Like this:

  /* hard way */
  if condition1 then do
    if \subcondition2 then do
      v1=calculation(a,b)
      v2=calculation(c,d)
      if v1<v2 & v1>5 then do
        /* process your logic */
        end
      end
    end

You can't make it a pure CASE statement because of the calculations you have to 
perform inside the block.  But you can do this:

  /* I prefer: */
  do until true /* in other words, do once */
    if \condition1 then leave
    if subconfition2 then leave
    v1=calculation(a,b)
    v2=calculation(c,d)
    if \(v1<v2 & v1>5) then leave
    /* process your logic */
    end

I think this is simpler to look at.

---
Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313

/* God's never been disappointed in me, because he never had any illusions 
about me.  -Clay McLean */

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On Behalf 
Of Paul Gilmartin
Sent: Thursday, February 27, 2020 17:29
> 
UNTIL has the minor simplification over WHILE in that it's not evaluated
until the end, so its variables needn't be preset.  I've taken advantage of
that on occasion.

--- On Thu, 27 Feb 2020 21:58:29 +0000, Gibney, Dave wrote:
>I left out the bit where the addition was conditional. 
>I suppose using the while or until is actually more understandable anyway.

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