Code Comments
Programming Forum and web based access to our favorite programming groups."Robert Wagner" <spamblocker-robert@wagner.net> wrote in message news:gofoo0d583dus7p7vvcfn5mo75a90atqhd@ 4ax.com... > On 5 Nov 2004 11:08:22 -0800, riplin@Azonic.co.nz (Richard) wrote: > <snip> > If change is gradual, the same themes appear in old and new code. > There isn't a scism or fracture. A weak but current example is > replacing GO TO THE-EXIT with EXIT PERFORM. > which, of course, assumes that your compiler supports EXIT PERFORM. I think (from other posts) that it is safe to assume that some (all?) Unisys mainfra me compilers support this. HOWEVER, it would be impossible for an IBM mainframe shop to make this "gradual change" - as the compiler still doesn't support t he syntax. -- Bill Klein wmklein <at> ix.netcom.com
Post Follow-up to this messageI was mistaken as to current behavior. The way EXIT PERFORM acts in COBOL85 (and COBOL74) is more like my proposed EXIT PERFORM CYCLE for out-of-line PERFORMs. Where control passes to is *before* the control logic for the PERFORM, not *after*. I still stand by my contention that EXIT PERFORM should land you after the PERFORM itself, whether inline or not, and EXIT PERFORM CYCLE should land you after the statements being PERFORMed, whether inline or not, for future standards. -Chuck Stevens "Lueko Willms" <l.willms@jpberlin.de> wrote in message news:9KVQWxzeflB@jpberlin-l.willms.jpberlin.de... > . On 08.11.04 > wrote charles.stevens@unisys.com (Chuck Stevens) > on /COMP/LANG/COBOL > in cmo6lp$1euc$1@si05.rsvl.unisys.com > about Re: Infinite Loops and Explicit Exits > > > CS> "William M. Klein" <wmklein@nospam.netcom.com> wrote > > WK>> which, of course, assumes that your compiler supports EXIT > WK>> PERFORM. I think (from other posts) that it is safe to assume > WK>> that some (all?) Unisys mainframe compilers support this. > > CS> Suspect it's limited to the Unisys MCP COBOL compilers, as it has its > CS> functional genesis on that architecture in the EXIT HERE extension in > CS> COBOL(68). That was quite a while before the Burroughs/Sperry > CS> merger, and I'd be surprised if Univac 1100/2200 COBOL followed the > CS> Burroughs Large System lead on this matter. > > No reason for surprise. In UCOB (UCS-COBOL), which is pure COBOL- > 85, there is no trace of it. The more recent OO-COBOL has a "EXIT > PERFORM" statement, but the manual states that the "EXIT PERFORM > statement is treated as a comment if used outside an in-line PERFORM > statement". > > I would say, that you on the MCP side are stuck with this > extension, and can't get rid of it because certainly some customer has > used it somewhere. > > For all others it is better to change a PERFORM procedure-name into > an "inline PERFORM" instead of introducing another level of > obfuscation. > > BTW, I just read about EXIT PERFORM in the "COBOL ANSI-85 > Programming Reference Manual, Volume 1: Basic Implementation" (Unisys > Document 86001518-306) for the Unisys MCP Series, and found that "EXIT > PERFORM" only "will terminate format 1 PERFORM statements." Format 1 > PERFORM refers to the simple basic PERFORM which does not specify any > repetition. "All other PERFORM statement formats terminate only when > the specified terminating conditions are met." (Page 6-121). > > This is quite different from the impression I got from your > proposals here, that the EXIT PERFORM would override the terminating > condition specified on a PERFORM UNTIL ... statement, as the EXIT > PERFORM is specified to do according to the current COBOL standard. > > This kind of EXIT PERFORM can better be expressed by these EXIT > SECTION or EXIT PARAGRAPH or even better, by a proper conditional > statment with IF ... THEN .. ELSE .. END-IF, or EVALUATE. > > But the other examples given for PERFORM x TIMES and PERFORM UNTIL > are rather confusing and show rather awkward code. > > The example given on page 6-122 > > MAIN. > PERFORM p1 UNTIL WS-COUNT = 5 > DISPLAY "Count = " WS-COUNT. > STOP RUN. > > P1. > ADD 1 TO WS-COUNT. > IF (WS-COUNT > 1) > EXIT PERFORM > ELSE > CONTINUE > END-IF. > DISPLAY "WS-COUNT = " WS-COUNT > > > which is supposed to result in one > WS-COUNT = 1 > and one > Count = 5 > because the EXIT PERFORM is supposed just to jump over the 'DISPLAY > "WS-COUNT ...' after the END-IF, but not to shortcut the condition > specified on the PERFORM statement. > > > clearer would be this: > > P1. > ADD 1 TO WS-COUNT > IF WS-COUNT > 1 > THEN > CONTINUE > ELSE > DISPLAY "WS-COUNT = " WS-COUNT > END-IF > . > > or > P1. > ADD 1 TO WS-COUNT > IF NOT WS-COUNT > 1 > THEN > DISPLAY "WS-COUNT = " WS-COUNT > END-IF > . > > > This EXIT PERFORM in the MCP variant acts quite differently from > the way EXIT PERFORM is specified in the 2002 standard, according to > which it bypasses the terminating condition for the loop. > > There is a conflict coming up when this compiler tries to be > conformant with the 2002 standard. > > > Yours, > Lüko Willms http://www.willms-edv.de > /--------- L.WILLMS@jpberlin.de -- Alle Rechte vorbehalten -- > > Das Buch muß erst ausgedroschen werden. -G.C.Lichtenberg
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.