Ampersand Variables


I’m trying to learn how to use the “ampersand variables”, and i cannot solve one problem.

When I execute the “RUN” statement in my program, calling the program with the ampersand variables, all runs well, but my main program stop. How can i continue with the execution of my main program after doing this “RUN”?

Thanks a lot
Best regards.

This is not too difficult; HOWEVER, since there is not a RUN RETURN (as there is a FETCH RETURN), you will end up returning to the beginning of the program that did the RUN.


The program REPT01 will simply STOP (or reach the END statement).

If appropriate, you could leave a “flag” for yourself, by means of the STACK to indicate where you came from.


or just add
FETCH ‘MAIN01’ ‘somerestartindicator’
to the end of “REPT01”

However. if REPT01 will be RUN from various programs, better to have each program establish its own return (with a STACK statement).

If it is indeed a one to one situation, and REPT01 will only be RUN from MAIN01, there really is no difference.