Re: CASE constructs
I don't know enough COBOL to contribute much more on that score. But I can now recall some of the COBOL programmer's words, "ALTER GOTO is the only sensible support for structured programming" which sounds like an eccentric view, if not actually mad :-) He was clearly good at his job, though, and a clear thinker when it came to program design. It takes all sorts. And now I must spend few days in 'monk mode' to do some boring but necessary stuff! Roops On Sat, 1 Apr 2023, 13:04 Paul Gilmartin, < 042bfe9c879d-dmarc-requ...@listserv.ua.edu> wrote: > On Sat, 1 Apr 2023 11:30:24 +0100, Rupert Reynolds wrote: > >... > >while in COBOL people were using ALTER with GOTO (oof!). > > > ??? > But didn't they need a CASE/SELECT to choose which ALTER? > > -- > gil > > -- > 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
Re: CASE constructs
"people were using" is not the same as "the language only has". There are far too many people who treat software as static, and only use what they learned initially. I, OTOH, am OCD about what has changed in the software that I am using. It's amazing who many times someone tells me that, e.g., ISPF, can't do something that I have been using for ages. So I can fully believe, but not approve of, that there are people still using ALTER (if it still exists) in blissful igorance of better methods. Do I like COBOL? No, but that doesn't mean that bogus criticism of it won't raise my hackles. -- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 From: IBM Mainframe Discussion List [IBM-MAIN@LISTSERV.UA.EDU] on behalf of Rupert Reynolds [rreyno...@cix.co.uk] Sent: Saturday, April 1, 2023 6:30 AM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: CASE constructs I seem to remember that most of the perceived weaknesses in COBOL were addressed a long time ago. But some old tales just won't die. Back when JSP meant Jackson Structured, I remember being told that PL/I supported selection directly with 'SELECT', while in COBOL people were using ALTER with GOTO (oof!). It may have been true, briefly, but it seems COBOL caught up in most respects reasonably quickly. Roops On Sat, 1 Apr 2023, 02:24 Frank Swarbrick, wrote: > 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. > > 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 -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: CASE constructs
On Sat, 1 Apr 2023 11:30:24 +0100, Rupert Reynolds wrote: >... >while in COBOL people were using ALTER with GOTO (oof!). > ??? But didn't they need a CASE/SELECT to choose which ALTER? -- gil -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN
Re: CASE constructs
I seem to remember that most of the perceived weaknesses in COBOL were addressed a long time ago. But some old tales just won't die. Back when JSP meant Jackson Structured, I remember being told that PL/I supported selection directly with 'SELECT', while in COBOL people were using ALTER with GOTO (oof!). It may have been true, briefly, but it seems COBOL caught up in most respects reasonably quickly. Roops On Sat, 1 Apr 2023, 02:24 Frank Swarbrick, wrote: > 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. > > 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
Re: CASE constructs
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 on behalf of Gibney, Dave <03b5261cfd78-dmarc-requ...@listserv.ua.edu> Sent: Thursday, March 30, 2023 10:22 PM To: 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 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 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
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 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 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