On Mon, 8 Jun 2020 20:50:12 -0500, Joe Monk wrote: >In this case, because we are PERFORMing THRU, then GO TO exit, merely >causes an iterate. > It's so nice of COBOL to be written in common language so any English speaker can intuitively grasp it correctly.
>On Mon, Jun 8, 2020 at 7:36 PM Frank Swarbrick wrote: > >> GO TO to an "exit" procedure (that is, a procedure that terminates >> unconditionally terminates the program) is, in my mind, acceptable as >> well. In fact, if you try to "perform" a "terminal" exit procedure the >> compiler will give you a warning that your "calling" procedure will never >> reach its exit. >> >> ________________________________ >> From: Joe Monk >> Sent: Saturday, June 6, 2020 2:49 AM >> >> I think what you mean is this: >> >> PERFORM 1050-LOOP THRU 1059-EXIT VARYING JC FROM 1 BY 1 UNTIL JC = 99 >> END-PERFORM >> >> 1050-LOOP. >> IF FIRST-NAME NOT = "ROBERT" >> GO TO 1059-EXIT >> END-IF >> IF TYPE NOT = 195 >> GO TO 1059-EXIT >> END-IF >> IF NOT SO-ON >> GO TO 1059-EXIT >> END-IF >> IF NOT SO-FORTH >> GO TO 1059-EXIT >> END-IF >> PERFORM 1050-SUCH-AND-SUCH END-PERFORM >> >> 1059-EXIT. >> EXIT. >> >> In structured programming, it is perfectly acceptable to use GO TO within a >> paragraph. It is NOT acceptable to use GO TO outside of a paragraph. >> >> On Sat, Jun 6, 2020 at 12:42 AM Bob Bridges wrote: >> >> > I realize this is a bit of a change in subject (and it's not as if we need >> > yet another one), but I avoid this construction. My phobia is based on an >> > extreme example: In their zeal never to use GOTOs, I've frequently seen >> > programmers write paragraphs like this: >> > >> > PERFORM 1050-LOOP VARYING JC FROM 1 BY 1 TO 99 >> > >> > 1050-LOOP. >> > IF X < 1000 >> > IF FIRST-NAME NOT = "ROBERT" >> > IF TYPE = 195 >> > IF SO-ON >> > IF SO-FORTH >> > EXECUTE 1050-SUCH-AND-SUCH >> > END-IF >> > END-IF >> > END-IF >> > END-IF >> > END-IF >> > >> > Gives me a headache to try to evaluate that. Much better, in my opinion, >> > to introduce ONE LOUSY "GOTO EO-PARAGRAPH" like this: >> > >> > PERFORM 1050-LOOP THRU 1059-LOOP VARYING JC FROM 1 BY 1 TO 99 >> > >> > 1050-LOOP. >> > IF X > 999 GOTO 1059-LOOP. >> > IF FIRST-NAME = "ROBERT" GOTO 1059-LOOP. >> > IF TYPE <> 195 GOTO 1059-LOOP. >> > IF NOT SO-ON GOTO 1059-LOOP. >> > IF NOT SO-FORTH GOTO 1059-LOOP. >> > EXECUTE 1050-SUCH-AND-SUCH >> > 1059-LOOP. >> > >> > Keep in mind I haven't programmed in COBOL since Y2K; I had to look up the >> > syntax, I probably got part of it wrong nonetheless, and I'll bet there are >> > easier ways to do it nowadays. In REXX, for example, they have the ITERATE >> > statement: >> > >> > do jc=1 to 99 >> > if x>99 then iterate >> > if firstname='ROBERT' then iterate >> > if type<>195 then iterate >> > if \soon then iterate >> > if \soforth then iterate >> > call suchandsuch >> > end >> > >> > However you do it, I vastly prefer skip-to-next-item over nested Ifs. But >> > I confess that one single nested IF is not going to give me a headache; I >> > just react when I see one. Not your fault :). >> > >> > -----Original Message----- >> > From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On >> > Behalf Of Gibney, Dave >> > Sent: Friday, June 5, 2020 16:17 >> > >> > Using OP >> > IF TVOLL (IND1) NOT = HIGH-VALUE >> > AND SMOD (IND1) = 'B' OR 'R' >> > >> > I would do >> > IF TVOLL (IND1) NOT = HIGH-VALUE >> > IF SMOD (IND1) = 'B' OR 'R' >> > Do the stuff -- gil ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN