home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / lang / fortran / 4409 < prev    next >
Encoding:
Text File  |  1992-11-22  |  1.5 KB  |  55 lines

  1. Newsgroups: comp.lang.fortran
  2. Path: sparky!uunet!spool.mu.edu!umn.edu!csus.edu!netcom.com!jchauvin
  3. From: jchauvin@netcom.com (John H. Chauvin)
  4. Subject: Multiple returns (was: Jumping from nested subs to main directly)
  5. Message-ID: <1992Nov23.021053.11218@netcom.com>
  6. Organization: Netcom - Online Communication Services  (408 241-9760 guest) 
  7. Date: Mon, 23 Nov 1992 02:10:53 GMT
  8. Lines: 45
  9.  
  10.  
  11. I would like to thank everyone who responded to my 
  12. original posting. Unfortunately, in my haste to post the 
  13. original message, I neglected to fully explain my 
  14. problem. My use of the word "Jumping" may have been 
  15. misleading. I was looking for a simple way to simulate 
  16. multiple returns back to the main routine without having 
  17. to add the code to all the subroutines to force a return 
  18. if an error is detected upon exiting a subroutine. The 
  19. ENTRY solution proposed does not fit the bill because I 
  20. have not RETURNed to main. What would be nice is a form 
  21. of RETURN that would allow the programmer to return back 
  22. more than one subroutine.For example, let say that I 
  23. want to return from SUB3 to SUB1 directly. I would just 
  24. execute a command like EXIT 2 or something like that.I 
  25. do not believe this is currently possible? Any comments?
  26.  
  27.  
  28.  
  29. PROGRAM EXAMPLE
  30. CALL SUB1
  31. .
  32. .
  33. .
  34. STOP
  35. END
  36. SUB1
  37. CALL SUB2
  38. A=A+1
  39. END
  40. SUB2
  41. CALL SUB3
  42. END
  43. SUB3
  44.  
  45. EXIT 2 (Returned to statement A=A+1 in one call)
  46.  
  47. END
  48.  
  49. Thanks for the help
  50.  
  51. jchauvin@netcom.com
  52. -- 
  53. John H. Chauvin jchauvin@netcom.COM
  54. Netcom - Online Communication Services San Jose, CA
  55.