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



+1

On 3/14/2023 1:05 PM, Nathan Andelin wrote:
I asked Barbara Moris 20+ years ago if ILE RPG might ever become an
object-oriented language. At that time she indicated that it was a subject
of debate within IBM.

She however suggested that I might enjoy writing service programs which
exported procedures pertaining to objects, including a procedure for
instantiating new objects. The "new()" procedure would use %alloc() to
return a pointer to a data structure, which contained all the object
properties (data-structure sub-fields).

For example, if the "object" were a "stream file", you might instantiate a
stream file using a procedure named perhaps stmfNew(), which would return a
pointer to a data structure instantiated via %alloc(). Internally, I might
name that data structure "stmf", and include all its attributes, such as
the IFS file name pertaining to it.

After writing a "new()" procedure, write other procedures which include a
parameter for passing an "object" reference, which would be the pointer to
that allocated data structure.

Bottom line is that while ILE RPG may not have all the characteristics of
an OO language, you as a programmer can do OO things with ILE RPG, if you
like that approach.

Every time a new() procedure is called, I store the pointer returned from
%alloc() in an internal linked list, which provides a means of deallocating
any data structures that may have been instantiated during the use of the
service program.


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.