COBOL:

EVALUATE A = 1
WHEN TRUE [...]
WHEN FALSE [...]
END-EVALUATE

(WHEN FALSE could be WHEN OTHER in this case.)

Not many people would use this over IF ELSE, but it's available.

There's also "EVALUATE TRUE" where each WHEN is a full evaluation, eliminating 
any need for IF ELSE/IF ELSE/IF ELSE.
________________________________
From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> on behalf of 
Gibney, Dave <000003b5261cfd78-dmarc-requ...@listserv.ua.edu>
Sent: Thursday, March 30, 2023 10:22 PM
To: IBM-MAIN@LISTSERV.UA.EDU <IBM-MAIN@LISTSERV.UA.EDU>
Subject: CASE constructs

In the CASE of Software AG's language, Natural, it is WHEN ANY and WHEN NONE. 
ANY would execute after the code of the successful WHEN condition. Once in a 
while, I would wish it would execute before rather than after.

> -----Original Message-----
> From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On
> Behalf Of Bob Bridges
> Sent: Thursday, March 30, 2023 1:59 PM
> To: IBM-MAIN@LISTSERV.UA.EDU
> Subject: Re: Stop the ragging on COBOL please [was: RE: ASM call by value]
>
> [EXTERNAL EMAIL]
>
> Ok, I'll bite:  What's the difference between the ANY and OTHER conditions?
>
> Oh, wait, cool!  Does the ANY condition execute even any of the above
> conditions evaluate as true?
>
> ---
> Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313
>
> /* It is a serious thing to live in a society of possible gods and goddesses, 
> to
> remember that the dullest and most uninteresting person you talk to may
> one day be a creature which, if you saw it now, you would be strongly
> tempted to worship, or else a horror and a corruption such as you now meet,
> if at all, only in a nightmare.  All day long we are, in some degree, helping
> each other to one of these destinations.  -C S Lewis, quoted in "In His Image"
> by Dr Paul Brand and Phillip Yancey */
>
> -----Original Message-----
> From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On
> Behalf Of Wayne Bickerdike
> Sent: Wednesday, March 29, 2023 23:40
>
> I also like CA-IDEAL. A little bit PL/I like with a nice SELECT statement:
>
>   SELECT TRANS_CODE
>     WHEN 'A'
>       DO ADD_RECORD_PROC
>     WHEN 'D'
>       DO DEL_RECORD_PROC
>     WHEN 'P'
>       DO PURCHASE_PROC
>     WHEN 'R'
>       DO RECEIPT_PROC
>     WHEN ANY
>       DO LOG_TRANS
>     WHEN OTHER
>       DO INVALID_CODE
>     ENDSEL
>
> ----------------------------------------------------------------------
> 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