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
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
As an Amazon Associate we earn from qualifying purchases.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.