# Use GDA in Functions

**URL:** <https://techcommunity.softwareag.com/t/use-gda-in-functions/173480>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-Code-Samples\
**Created:** [November 27, 2013, 11:10am UTC](https://techcommunity.softwareag.com/t/use-gda-in-functions/173480 "2013-11-27T11:10:10Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![mwessjoh](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mwessjoh](https://techcommunity.softwareag.com/u/mwessjoh)\
**Post date:** [November 27, 2013, 11:10am UTC](https://techcommunity.softwareag.com/t/use-gda-in-functions/173480/1 "2013-11-27T11:10:10Z")

</div>

Hi,

is it possible to use GDAs in functions?

Best regards,  
Markus Wessjohann

---

<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:** [November 27, 2013, 1:16pm UTC](https://techcommunity.softwareag.com/t/use-gda-in-functions/173480/2 "2013-11-27T13:16:32Z")

</div>

Hi Markus;

I have been unable to find any comment in the documentation that says this is permitted or denied.

I have tried to “check” functions with varied positionality for a GDA; no luck.

All that said, it would seem counter intuitive to permit this. Every user of the function would have to have the same GDA and use the same variable names; an administrative nightmare.

steve

---

<div class="post-metadata">

**Author:** ![mwessjoh](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mwessjoh](https://techcommunity.softwareag.com/u/mwessjoh)\
**Post date:** [November 27, 2013, 2:44pm UTC](https://techcommunity.softwareag.com/t/use-gda-in-functions/173480/3 "2013-11-27T14:44:21Z")

</div>

Hi,

I wouldn’t work that out, so I asked, maybe I did something wrong.

What I wanted is, that I what to “hide” the GDA behind functions. No natural modul get direct access to the GDA. All moduls have to use a function to set or get a GDA-Variable.

I can use a subprogram, but I thought functions are easier to use.

Best regards,  
Markus Wessjohann

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [December 2, 2013, 4:26pm UTC](https://techcommunity.softwareag.com/t/use-gda-in-functions/173480/4 "2013-12-02T16:26:06Z")

</div>

Hi Markus,

Sounds more like you want to set AIV values, not use a GDA. I don’t see why you couldn’t use functions or subprograms to set AIVs. Keep in mind AIV values get reset when you issue a LOGON command, so you’ll want some LOGONEX1 to run any time someone changes libraries to re-assign AIV values if you decide to go that way.

-Brian

---

<div class="post-metadata">

**Author:** ![mwessjoh](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mwessjoh](https://techcommunity.softwareag.com/u/mwessjoh)\
**Post date:** [December 2, 2013, 5:07pm UTC](https://techcommunity.softwareag.com/t/use-gda-in-functions/173480/5 "2013-12-02T17:07:20Z")

</div>

> [@Brian Johnson](#):
>
> Hi Markus,
> 
> Sounds more like you want to set AIV values, not use a GDA. I don’t see why you couldn’t use functions or subprograms to set AIVs. Keep in mind AIV values get reset when you issue a LOGON command, so you’ll want some LOGONEX1 to run any time someone changes libraries to re-assign AIV values if you decide to go that way.
> 
> -Brian

Hi,

I want to hide the GDAs/AIV. This gives my more controll, whitch programs get access to them.  
I can addional security option to the GDA/AIV-Access-programs. Can program ABC modify GDA value XYZ, can program DEF modify GDA value WVX? Log all changes in one place etc.

If all programs uses only the GDA/AIV-Access-programs it is no problem to add a new GDA variable. I only have to cat all Access-programs.

AIV are reseted on LOGON is ok, GDAs as well 😉

AIV with functions is a good point, I’ll think abut this.

What I really want is to use no GDAs/AIV at all, but if thats doesn’t work, I want to get more controll of it.

Best regards,

Markus Wessjohann

---

<div class="post-metadata">

**Author:** ![Brian\_Johnson1](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/brian_johnson1/32/163_2.png) [@Brian\_Johnson1](https://techcommunity.softwareag.com/u/Brian_Johnson1)\
**Post date:** [December 3, 2013, 2:27am UTC](https://techcommunity.softwareag.com/t/use-gda-in-functions/173480/6 "2013-12-03T02:27:15Z")

</div>

Another idea is to store these values in an Adabas file, and you can control and secure access to them through modules hidden in a protected steplib. You could build functions or subprograms that retrieve and set these values and even preserve them across LOGONs.

Just thinking out loud…

---

<div class="post-metadata">

**Author:** ![mwessjoh](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mwessjoh](https://techcommunity.softwareag.com/u/mwessjoh)\
**Post date:** [December 3, 2013, 9:17am UTC](https://techcommunity.softwareag.com/t/use-gda-in-functions/173480/7 "2013-12-03T09:17:21Z")

</div>

Hi,

I want an easy and a fast way to controll the GDA-variables. If I use a Adabase file I have to think about to how to capsulate the different natural-sessions.  
Example:

User A is working on Police 1234 and User B on Police 3456. User B as another session with Police 7890. So I will have to different the users and the sessions.  
Another point is, that all the DB-traffic will be very high. There are many moduls that get access to the GDA.  
I think that isn’t an option.

I wanted to use function, to have an easy way:

SET-POLICE( \<12345\> )

IF IS-POLICE-STATUS( )

- Do work  
END-IF

With Subprograms will it look like:

RESET GDA-PDA  
GDA-PDA.GDAFIELD(1) := ‘POLICE’  
GDA-PDA.POLICE := 12345  
CALLNAT ‘SETGDA’ GDA-PDA

RESET GDA-PDA  
CALLNAT ‘GETGDA’ GDA-PDA

IF GDA-PDA.POLICE-STATUS EQ C-OPEN

- Do work  
END-IF

Another problem is that I the PDA musst look like GDA and when I am changing the GDA I musst change the PDA =\> CAT ALL.

If GDAs doesn’t work with function I will try something else.

Best regards,

Markus Wessjohann

---

<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, 3:29pm UTC](https://techcommunity.softwareag.com/t/use-gda-in-functions/173480/8 "2021-04-02T15:29:53Z")

</div>


