× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On 11/1/05, Jon Paris <Jon.Paris@xxxxxxxxxxxxxx> wrote:
>  >> I'm looking for a way that I can display or print the value of a Pointer
> in RPG IV.

there is a materialize pointer instruction in MI. this will show the
object the pointer points to.  If the pointer is a space pointer, the
materialize instruction will also show the pointer offset within the
space.  You can most likely call that instruction, MATPTR, from RPG.

if you are dealing with a pointer to a variable ( a space pointer )
you can see some useful information by cracking open the last 8 bytes
of the pointer.  The last 3 bytes of this 2nd half holds the offset
within the space - you can just display this as an integer value. The
first 5 bytes of the 2nd half contains the object segment identifier.
The segment id is a unique idenfifier of the 16 meg segment object -
whatever it is called - that the offset is located within. If you
display this 5 byte value in hex you can compare two pointers to know
if they address the same space object.

>
> Simply map it to a character field (or multiple integers for that matter)
> via a DS.  You still won't be able to "prove" that it is a valid pointer
> since there is no way to directly incorporate the tag bit but ... I guess if
> it were critical you could incorporate a test for *NULL and output that
> information too.
>
> However, seeing the pointer value is pretty useless information - it doesn't
> even really help in testing even since the data it points to may be the
> same - but the address of the pointer different.  Since a pointers purpose
> is to "point" to data - why not simply dereference the pointer (i.e. use it
> as a basing pointer) for an arbitrary field and display the content of that
> field?  I would think that seeing if the data matches is far more useful
> than knowing the value of the pointer anyway.

Jon, it is not like the pointer is something modern, like a managed
code object reference :)  ILE C and I guess RPG can compare two
pointers, returning a result that one is greater or less than another.
For debug purposes, the programmer needs to know how one pointer into
a buffer compares against another.

-Steve


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.