× 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.


  • Subject: Re: RPG IV Pointers
  • From: Paul Tuohy <tuohyp@xxxxxxxxxxxxx>
  • Date: Tue, 29 Feb 2000 22:46:42 +0000

Hi Jim,

Barbara already answered your original question and I don't know if this helps
clarify or confuse. But for what it's worth ;-)

The BASED keword means that an address is not allocated to the field at
compilation. At run time, an address will be allocated Based on the value of the
pointer field.

D MyPointer                  S                          *
D MyField                     S                      10
Based(MyPointer)

D Fld1                           S                      10
Inz('ABC')
D Fld2                           S                      10
Inz('XYZ')

C                                Eval    MyPointer = %Addr(Fld1)
  *
  * MyField now share the same memory location as FLD1, so MyField has a value 
of
'ABC'.

C                                Eval    MyField = 'DEF'

  * Fld1 now has a value of DEF

C                                Eval    MyPointer = %Addr(Fld2)
  *
  * MyField now share the same memory location as FLD2, so MyField has a value 
of
'XYZ'.

C                                Eval    MyField = 'UVW'

  * Fld2 now has a value of UVW

HTH

Paul Tuohy



Jim Langston wrote:

<big snip>

> Perhaps I am not understanding what the BASED keyword is doing.
> Just what does it do?

<end snip>

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


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.