# Function to get a variable value by name

**URL:** <https://techcommunity.softwareag.com/t/function-to-get-a-variable-value-by-name/79364>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-News-and-General-Topics\
**Created:** [October 27, 2008, 6:08pm UTC](https://techcommunity.softwareag.com/t/function-to-get-a-variable-value-by-name/79364 "2008-10-27T18:08:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![samueldc](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@samueldc](https://techcommunity.softwareag.com/u/samueldc)\
**Post date:** [October 27, 2008, 6:08pm UTC](https://techcommunity.softwareag.com/t/function-to-get-a-variable-value-by-name/79364/1 "2008-10-27T18:08:58Z")

</div>

Hi Everybody,

Is there any function to get a variable value by its name?

Something like this:

color=“red”

IF GETVAL(“CLIENT-NUMBER”) EQ 0  
WRITE ‘REQUIRED…’  
END-IF

(…)[/color]

---

<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:** [October 27, 2008, 10:09pm UTC](https://techcommunity.softwareag.com/t/function-to-get-a-variable-value-by-name/79364/2 "2008-10-27T22:09:39Z")

</div>

Do you mean the VAL function which can get the numeric value of an alpha field?

If you really wanted to just check for a null value, you could also check for a blank.

steve

---

<div class="post-metadata">

**Author:** ![samueldc](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@samueldc](https://techcommunity.softwareag.com/u/samueldc)\
**Post date:** [October 28, 2008, 12:23am UTC](https://techcommunity.softwareag.com/t/function-to-get-a-variable-value-by-name/79364/3 "2008-10-28T00:23:46Z")

</div>

No. I’m wondering if there’s a function that gets a variable name by a string parm and returns its value. Imagine you wanna make a generic validation subroutine that accesses previosly registered variables values by their names.

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [October 28, 2008, 2:37am UTC](https://techcommunity.softwareag.com/t/function-to-get-a-variable-value-by-name/79364/4 "2008-10-28T02:37:00Z")

</div>

This is possible with the RUN statement, but it is unlikely that you’ll find the flexibility that you expect. Read the section called Dynamic Source Text Creation/Execution.

ps It is not necessary to post the same question in multiple threads.

---

<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:51pm UTC](https://techcommunity.softwareag.com/t/function-to-get-a-variable-value-by-name/79364/5 "2021-04-02T14:51:05Z")

</div>


