Re: pattern for an error



You should only return from the PERFORM of a routine with an EXIT PROGRAM, if
the executing program is a MAIN program. If you don't leave from a sub-program,
then there is a bug - or something else you aren't telling us.

Depending on the compiler, you might want to replace EXIT PROGRAM with GOBACK.
When available (it was an extension to the '85 Standard - but a common one that
is now Standard), you will "go up a level" from a subprogram and will "stop run"
from a main program.

If you STILL get to the DISPLAY, then there must be something going on that you
haven't told us about.

--
Bill Klein
wmklein <at> ix.netcom.com
"mario" <mmc_vw1200@xxxxxxxxxxx> wrote in message
news:af17cd6e-a738-4718-80f6-c1c4376446a6@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
i already tried but "exit program" does no exit

for example

gogogo.
display "hi"
perform error_occurs
display "hi after error"

.

error_occurs
exit program
.


i come back to the second display "hi after error" so the "EXIT
PROGRAM" does not realy that what it sould right???


.



Relevant Pages

  • About your example...
    ... given COBOL program. ... PROCEDURE DIVISION. ... DISPLAY "B". ... EXIT PROGRAM. ...
    (comp.lang.cobol)
  • Re: COBOL Perform?
    ... I expected the EXIT PROGRAM to terminate the program at the end of the mainline, but it seems to fall through and go execute the paragraphs below it. ... PERFORM UNTIL WS-EOF-FLAG = 'Y' DISPLAY ' TEXT FROM PERFORM UNTIL' ... DISPLAY ' TEXT FROM PERFORM WRITE-TEXT1' ... DISPLAY ' TEXT FROM PERFORM WRITE-TEXT2' ...
    (comp.os.vms)
  • Re: pattern for an error
    ... i already tried but "exit program" does no exit ... gogogo. ... display "hi after error" ... PROGRAM" does not realy that what it sould right??? ...
    (comp.lang.cobol)