home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!spool.mu.edu!umn.edu!csus.edu!netcom.com!jchauvin
- From: jchauvin@netcom.com (John H. Chauvin)
- Subject: Multiple returns (was: Jumping from nested subs to main directly)
- Message-ID: <1992Nov23.021053.11218@netcom.com>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- Date: Mon, 23 Nov 1992 02:10:53 GMT
- Lines: 45
-
-
- I would like to thank everyone who responded to my
- original posting. Unfortunately, in my haste to post the
- original message, I neglected to fully explain my
- problem. My use of the word "Jumping" may have been
- misleading. I was looking for a simple way to simulate
- multiple returns back to the main routine without having
- to add the code to all the subroutines to force a return
- if an error is detected upon exiting a subroutine. The
- ENTRY solution proposed does not fit the bill because I
- have not RETURNed to main. What would be nice is a form
- of RETURN that would allow the programmer to return back
- more than one subroutine.For example, let say that I
- want to return from SUB3 to SUB1 directly. I would just
- execute a command like EXIT 2 or something like that.I
- do not believe this is currently possible? Any comments?
-
-
-
- PROGRAM EXAMPLE
- CALL SUB1
- .
- .
- .
- STOP
- END
- SUB1
- CALL SUB2
- A=A+1
- END
- SUB2
- CALL SUB3
- END
- SUB3
-
- EXIT 2 (Returned to statement A=A+1 in one call)
-
- END
-
- Thanks for the help
-
- jchauvin@netcom.com
- --
- John H. Chauvin jchauvin@netcom.COM
- Netcom - Online Communication Services San Jose, CA
-