• Subject: Imported pointer restrictions?
  • From: David Morris <dmorris@xxxxxxxxxxxxx>
  • Date: Fri, 31 Oct 1997 13:07:18 -0700

I have run into a problem using pointers.  I receive no error, just a null 
pointer when trying to set a pointer in the following case:

Declare a pointer "P1" in service program(s) "A" as exportable.
Declare a variable as based on "P1".

In service program "B" - 
Declare a pointer "P2" based on pointer "P3".
Activate service program "A" using an API.
Set "P3" by retrieving exported pointer "P1" using an API.
Set "P2" using ALLOC or %ADDR.

I receive no error and "P2" remains null.  If I base "P2" on a pointer 
that is not imported I do not have a problem.  Is there any way 
to do this?  Is this happening because I used the API to retrieve the 
export dynamically?  You cannot export a based variable, so 
I thought the next best thing would be to export the basing pointer.  
I get no error of any kind.  I am guessing that I am trying to operate 
outside of the area that my program is allowed to change.  If that is 
the case why no MCH3602?  It is as if the program is no longer 
activated.  I will probably just have to pass the pointer as a parm 
which will work but is not nearly as clean from the application's 
perspective.

I have used a similar technique to manipulate imported information 
areas (similar to a custom INFDS) in the past.  It appears the hitch 
is the pointer being based on a pointer that is dynamically imported.

Thanks for any insight.

David Morris
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List!  To submit a new         *
* message, send your mail to "RPG400-L@midrange.com".  To unsubscribe   *
* from this list send email to MAJORDOMO@midrange.com and specify       *
* 'unsubscribe RPG400-L' in the body of your message.  Questions should *
* be directed to the list owner / operator: david@midrange.com          *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].