× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



There is no COBOL statement equivalent to the RPG operation code (opcode) 
LEAVExx in the current implementations of COBOL for OS/400.  The last 
draft I saw of the next COBOL standard has an "EXIT PERFORM" statement for 
an inline PERFORM.  This has the same basic function as the RPG LEAVExx 
opcode.  However, I don't know if the Toronto COBOL compiler folks plan to 
implement it or not.  I've often wanted something like it.  Currently, the 
only method is to code an out-of-line perform such as:

Initiating-paragraph.
    perform Another-paragraph thru Another-paragraph-exit
            until Normal-loop-termination
         .         .         .
         .         .         .
         .         .         .
    set Normal-loop-termination to true
    .

Another-paragraph.
    do something
    if Exit-condition = true
        goto Another-paragraph-exit
         .         .         .
         .         .         .
         .         .         .
    .

Another-paragraph-exit.
    exit
    .

More-paragraphs-follow.
         .         .         .
         .         .         .
         .         .         .
         .         .         .

I generally avoid using a GOTO statement.  To code it without the GOTO, 
you have to nest an IF statement in the middle of your perform. Such as:

Initiating-paragraph.
    perform
            until Exit-condition
            or Normal-loop-termination
        do something
        if Exit-condition not = true
            do some other work
        end-if
    end-perform
    .

Hope this helps.

Michael Quigley
AS/400 Programming Coordinator
The Way International
www.TheWay.org

Original message:

------------------------------
date: Tue, 19 Apr 2005 16:35:08 +0800
from: cobol400-l@xxxxxxxxxxxx
subject: [COBOL400-L] "leave" keyword for cobol400

hello all!!!

     in rpg400 and rpgile there is an opcode "LEAVEXX" which is used to
leave a subroutine, loop etc..
What i want to do in my perform until -----, is i want to leave every now
and then. What keyword is used in cobol400 to leave a perform until loop,
just like a "LEAVE" in rpg.


MANY THANKS IN ADVANCE!!!
GODBLESS!!!


As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.