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



Scott Klement wrote:

Just curious the reason of based keyword design in RPG.  If they are
tightly integrated, why not just allow doing the following:
%addr(myField) = myPointer;

Hmmm... I don't know why they did things the way they did them.  Maybe
Barbara or Jon would know?


I don't recall how the decision was made, if I ever knew.  I think the
choices were 
   1. use BASED(ptr) (PL/I does it this way)
   2. use some indication like your USRSTG that the storage for the
variable was not fixed. 
      (COBOL does it this way, PL/I also does it this way)
      Actually, the BASED keyword could be used for this
          D myfield       s         10a    based       
              %addr(myfield) = whatever;
              myfield = 'x';
   3. require the pointer to be specified explicitly (C does it this
way)
          whatever->myfield = 'x';

I personally find the second way to be confusing for more than one level
of pointer (equivalent of a->b->c), when I see it in COBOL code, but
that is probably just because I'm used to the first way.  The third way
would have made it extremely difficult to use based fields in anything
but expressions.


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.