# Changing name of the variable dynamically

**URL:** <https://techcommunity.softwareag.com/t/changing-name-of-the-variable-dynamically/62217>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [May 22, 2007, 4:47pm UTC](https://techcommunity.softwareag.com/t/changing-name-of-the-variable-dynamically/62217 "2007-05-22T16:47:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![koolbuddy](https://avatars.discourse-cdn.com/v4/letter/k/ecd19e/32.png) [@koolbuddy](https://techcommunity.softwareag.com/u/koolbuddy)\
**Post date:** [May 22, 2007, 4:47pm UTC](https://techcommunity.softwareag.com/t/changing-name-of-the-variable-dynamically/62217/1 "2007-05-22T16:47:18Z")

</div>

Hi All,  
I want to change the name of a variable dynamically,  
For eg,  
Just by iteration, i want to have the variable names as,

V1  
V2  
V3  
V4  
V5

Anyone has any idea how to do this??

Thanks in advance…

---

<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:** [May 22, 2007, 5:28pm UTC](https://techcommunity.softwareag.com/t/changing-name-of-the-variable-dynamically/62217/2 "2007-05-22T17:28:25Z")

</div>

The closest thing to what you seem to be looking for is, of course, an array. For example, V (a3/1:5) which would allow you to reference V (#subscript), where #subscript could range from 1 to 5.

steve

---

<div class="post-metadata">

**Author:** ![koolbuddy](https://avatars.discourse-cdn.com/v4/letter/k/ecd19e/32.png) [@koolbuddy](https://techcommunity.softwareag.com/u/koolbuddy)\
**Post date:** [May 22, 2007, 6:37pm UTC](https://techcommunity.softwareag.com/t/changing-name-of-the-variable-dynamically/62217/3 "2007-05-22T18:37:15Z")

</div>

No actually, i am looking for changing the variable name dynamically and not various contents into an array like thing…

Hope u are getting it, what i am looking for…

---

<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:** [May 23, 2007, 5:44am UTC](https://techcommunity.softwareag.com/t/changing-name-of-the-variable-dynamically/62217/4 "2007-05-23T05:44:54Z")

</div>

Two possibilities are (1) copycode with parameters (e.g. &1& …etc) and (2) ampersand variables (e.g. WRITE &WRITE where &WRITE is replaced at run time by the contents of the global variable +WRITE.

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:41pm UTC](https://techcommunity.softwareag.com/t/changing-name-of-the-variable-dynamically/62217/5 "2021-04-02T14:41:11Z")

</div>


