GDA in sub programs

I read some where that we can not use GDA in a sub program. Recently when I come across an application, I found some of the sub programs using GDAs. Is it possible to access values of GDA in a sub program?

Yes, but the GDA is only shared between that subprogram and the internal and external subroutines it calls.
Regards, +o:-]

Fields defined in a GDA within a program are not available to called subprograms; they must be passed via the parameter list. Similarly, fields defined in a GDA within a subprogram are not available to called subprograms, nor are they available to the calling program.

The same GDA may be used in a program and subprogram, but they are separate instances - they may share field names, but do not share field values (i.e. not memory locations).

GDAs are legacy compilations of NATURAL 1 global variables. You should not use legacy stuff in new applications. Beginning with Natural 2 you have mechanisms of passing parameters by reference and encapsulation of functionalities by using subprograms / subroutines. So use this techniques instead.

Folks, you know my opinon about GDA (at least now you know).

There is a sub program which calls a program using FETCH RETURN. The values in GDA are initialised in the sub program. Then the called program acess the values from GDA and updates the values in GDA. The updated values in GDA are accessed in the sub program which called the program. Will GDA help in this situation?


Thanks Wilfried. It is working for me.

You could also use Stack to transport Parameters to the Programm which you CALL via FETCH RETURN.

But why don’t make a Subprogramm from the Programm you would FETCH RETURN and then write a new Programm which only only calls the Subprogramm to do the work?

Greetings Sascha