1. Consider a program 'A' calls program 'B' dynamically. Program 'B' allocates a structure and fills data in it and returns a pointer of the allocated structure to the calling program 'A'.
Now, can the structure allocated in program 'B' , be used in program 'A', as the allocating program ie 'B' has already ended.
2. What is the difference between builtin function ALLOCATE and the service CEEGTST
It doesn't matter which program allocates the storage as long as they are running in the same task. What does matter is that the storage must be explicitly allocated (getmain'ed) as opposed to being part of the 'local' storage the program uses for local variables, which goes away when the called program ends. Storage you explicitly allocate stays allocated until the task ends but you should explicitly free it too because your program may not be able to count on task termination to clean up.