Dhaya wrote: > Hi > > I am using jbase 4.1 release with T24. I have a query regarding the > usage of 'recursive return" statement > in Jbase programming language. I understood we can recursive return > to come out of subroutine to calling program. I have a requirement > where when the recursive return is executed, program control should > not come out > the subroutine used. It is that is there any way to code such as > > PROGRAM.ABORT: > > RETURN TO (PROGRAM.ABORT - 1) > > Because, i want this recursivee return to be executed 1 level down. > Can i use (PROGRAM.ABORT - 1) in jbasic > or Is there any alternate way to use. > Never, ever, ever, ever, ever, ever, ever, ever,ever, ever, ever, ever,ever,ever, use RETURN TO. That's ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever, ever ad infinitum.
For a start you will never debug it. Wanting to do this is a sign that your design is very wrong. jBC is a compiled language, therefore the line numbers have no meaning except in the debugger. There are some compiled languages that annotate lines but they are compiling broken languages. The reason that you are wanting to do this is either that you have used GOTO elsewhere in this program, or that you have called nested subroutines, discovered an error and now want to back out of all the GOSUBs until you can return from the subroutine. Either way, it means that you need to redesign your subroutine. Each GOSUB should check an error return and back out accordingly. This type of thing is why more modern languages have exceptions that can cascade back up the chain and be caught at an appropriate point. However jBC does not have this functionality so you must program accordingly. Now, personally, I think that the language should have had separate notation for subroutine vs gosub return, but it doesn't, so you are stuck with it. Review your design here - when you have to ask how to do something like this, it means the program is broken. Jim --~--~---------~--~----~------------~-------~--~----~ Please read the posting guidelines at: http://groups.google.com/group/jBASE/web/Posting%20Guidelines IMPORTANT: Type T24: at the start of the subject line for questions specific to Globus/T24 To post, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jBASE?hl=en -~----------~----~----~----~------~----~------~--~---
