# uses of global data area(GDA)

**URL:** <https://techcommunity.softwareag.com/t/uses-of-global-data-area-gda/97235>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-Add-on-Products, Natural-Other-Addons\
**Created:** [May 26, 2011, 12:38pm UTC](https://techcommunity.softwareag.com/t/uses-of-global-data-area-gda/97235 "2011-05-26T12:38:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![swan](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/swan/32/296_2.png) [@swan](https://techcommunity.softwareag.com/u/swan)\
**Post date:** [May 26, 2011, 12:38pm UTC](https://techcommunity.softwareag.com/t/uses-of-global-data-area-gda/97235/1 "2011-05-26T12:38:00Z")

</div>

hi guys,

plz tell me why global data area(GDA) is accessed only for programme and external subroutine.  
not for subprogramme ,internal subroutine and helproutine…

---

<div class="post-metadata">

**Author:** ![Matthias1](https://avatars.discourse-cdn.com/v4/letter/m/9fc348/32.png) [@Matthias1](https://techcommunity.softwareag.com/u/Matthias1)\
**Post date:** [May 26, 2011, 1:38pm UTC](https://techcommunity.softwareag.com/t/uses-of-global-data-area-gda/97235/2 "2011-05-26T13:38:40Z")

</div>

There are two philosopies:

1. Share data in a GDA and FETCH RETURN
2. Share data via Parameter and CALLNAT  
So from my point of view the completely separated memory for CALLNAT makes sense.

BTW: If you want to use GDA-like variables in a subprogram use DEFINE DATA INDEPENDENT.

GDA is accessable for an interal subroutine.

---

<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 26, 2011, 4:31pm UTC](https://techcommunity.softwareag.com/t/uses-of-global-data-area-gda/97235/3 "2011-05-26T16:31:57Z")

</div>

A Natural subprogram, in a very real sense, is a “generic” subroutine. The original design philosophy behind “subroutines”, many many years ago, was that they should be independent of the calling programs.

That is, you passed the required arguments to a subroutine, it did its thing, and it passed back the required output.

As a programmer “using a subroutine”, I was free to change anything in my calling program so long as the arguments I passed to the subroutine conformed to expected format and length. Similarly, as a programmer of a subroutine, as long as I did not change the interface, I could do anything I wanted within the subroutine.

Now suppose a Natural program and subprogram “shared” a Global Data Area. All of a sudden, the two routines are no longer independent of one another. If there is a variable in the GDA called #SUM which is used by both a program and a subprogram, and the programmer of the subprogram wants to change the name to something more descriptive like #SUM-OF-MONTHLY-EXPENSES. In order to do that, assuming they had the proper authority, they would change the GDA.

BUT, now everyone who used #SUM from the GDA, whether they called the subprogram or not, would have to change their code. What a nightmare.

That is almost assuredly one reason why subprograms are maintained as an independent entity.

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, 3:00pm UTC](https://techcommunity.softwareag.com/t/uses-of-global-data-area-gda/97235/4 "2021-04-02T15:00:18Z")

</div>


