# Ampersand Variables

**URL:** <https://techcommunity.softwareag.com/t/ampersand-variables/76189>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-News-and-General-Topics\
**Created:** [February 21, 2008, 6:52pm UTC](https://techcommunity.softwareag.com/t/ampersand-variables/76189 "2008-02-21T18:52:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eduardo\_Sisamon](https://avatars.discourse-cdn.com/v4/letter/e/c5a1d2/32.png) [@Eduardo\_Sisamon](https://techcommunity.softwareag.com/u/Eduardo_Sisamon)\
**Post date:** [February 21, 2008, 6:52pm UTC](https://techcommunity.softwareag.com/t/ampersand-variables/76189/1 "2008-02-21T18:52:40Z")

</div>

Hello.

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.

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [February 21, 2008, 7:11pm UTC](https://techcommunity.softwareag.com/t/ampersand-variables/76189/2 "2008-02-21T19:11:02Z")

</div>

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.

STACK TOP COMMAND ‘EXECUTE MAIN01’  
RUN ‘REPT01’

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.

steve

---

<div class="post-metadata">

**Author:** ![Douglas\_Kelly](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/douglas_kelly/32/102_2.png) [@Douglas\_Kelly](https://techcommunity.softwareag.com/u/Douglas_Kelly)\
**Post date:** [February 22, 2008, 12:33am UTC](https://techcommunity.softwareag.com/t/ampersand-variables/76189/3 "2008-02-22T00:33:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Steve\_Robinson](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/steve_robinson/32/107_2.png) [@Steve\_Robinson](https://techcommunity.softwareag.com/u/Steve_Robinson)\
**Post date:** [February 22, 2008, 1:51am UTC](https://techcommunity.softwareag.com/t/ampersand-variables/76189/4 "2008-02-22T01:51:27Z")

</div>

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.

steve

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:49pm UTC](https://techcommunity.softwareag.com/t/ampersand-variables/76189/5 "2021-04-02T14:49:09Z")

</div>


