I'm glad someone else is saying this about GOTOs. I was a COBOL developer for years before getting into ACF2, and argued strenuously (and futilely) for limited use of GOTOs at a shop where they'd all fallen for the religious belief that GOTO is Satan. Three clear places where a GOTO can make a program better, not worse, in COBOL:
1) GOTO EXIT-PROGRAM, where last messages be issued and other shutdown processed. 2) GOTO END-OF-SECTION, sort of like a LEAVE statement in REXX. 3) GOTO TOP-OF-LOOP, which would correspond to the ITERATE in REXX. (Nowadays I would probably write that as GOTO BOTTOM-OF-LOOP, but that's a detail.) Now that I'm doing a lot of VBA programming, I often use that third example to goto a label placed immediately before the Next statement; the label is invariably IterateSomething (IterateRow, IterateRegion or whatever) to keep me from forgetting that gotos are not to be used carelessly. So far I haven't convinced myself that one of my VBA programs needs a GoTo of the second type, but usually the reason I want it is to avoid one of those long series of indented If statements you spoke of, and in VBA I can handle that with a one-time Do block: Do 'one time If RegionCode Like "W*" Then Exit Do If AddLimit < 99 Then Exit Do Set oaddr = User.GetAddress If Not CheckState(oaddr) Is Nothing Then Exit Do ' Now do what you wanted. Loop While False --- Bob Bridges, robhbrid...@gmail.com, cell 336 382-7313 /* October: The Boston Red Sox, ending an 86-year drought, defeat the St. Louis Cardinals to win the World Series. The Red Sox got into the Series thanks to the fact that the New York Yankees -- who were leading the American-League championships three games to none, and had all-stars at every position, not to mention a payroll larger than the gross national product of Sweden -- chose that particular time to execute the most spectacular choke in all of sports history, an unbelievable Gag-o-Rama, a noxious nosedive, a pathetic gut-check failure of such epic dimensions that every thinking human outside of the New York Metropolitan area experienced a near-orgasmic level of happiness. But there is no need to rub it in. -Dave Barry, 2004 in Review */ -----Original Message----- From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of David Crayford Sent: Sunday, September 25, 2022 07:52 Another thing that makes me incredibly dubious about some of the opinions in these videos is the hackneyed nonsense about "goto considered harmful". The original paper was misunderstood in that all goto statements are harmful and brainwashed a generation. Some of these videos present a trivial example using goto and refactor it using if/ifelse. In programming languages without scope based cleanup goto is not harmful. In fact it's leads to clean code as the branch direction is always descending to a cleanup block. Happily for me, the young guys I work with writing systems level Metal/C code haven't been seduced by this dogmatic BS. Good C code uses goto statements as opposed to heavily nested or superfluously functionally decomposed routines. The IBM Openj9 JVM C code is a case in point https://github.com/eclipse-openj9/openj9/blob/master/runtime/vm/classsupport.c. I challenge anybody to write better code without goto statements. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN