× 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: Overloading in RPG.
  • From: "Bartell, Aaron L. (TC)" <ALBartell@xxxxxxxxxxxxxx>
  • Date: Tue, 8 May 2001 11:40:12 -0500

I am wondering if anyone knows if "overloading" is in RPGILE's future.  I am
talking about overloading similar to what Java has.  I just found another
application where this would prove most valuable.

For those who don't know what overloading is it basically allows you the
programmer to have multiple methods(subprocedures) with the same name but
they accept different parm structures.  So in your RPG programs based on the
parameter types you pass it will decide which method(subprocedure) will
actual be called.

here is an example:

I could call #getDate with two or three parms. . .

C              callp      #getDate(parm1:parm2)
C              callp      #getDate(parm1:parm2:parm3)

and based on the data type of each parm and how many are passed it knows
which sub procedure to call.  You could have two #getDate sub procedures
that both receive two parms but have different data types for parm1 and
parm2.

Here is what #getDate would look like.

 *//////////////////////////////////////////////////////////////*
 * (#getDate) Get Date                                          *
 *//////////////////////////////////////////////////////////////*
P #getDate          B                   EXPORT                     
 *--------------------------------------------------------------*
D #getDate         PI              *                              
D  parm1                         4                               
D  parm2                         4

 *--------------------------------------------------------------*
C                   //put calcs in here

C                   return    ??                         
 *--------------------------------------------------------------*     
P #getDate        E 

...or...

 *//////////////////////////////////////////////////////////////*
 * (#getDate) Get Date                                          *
 *//////////////////////////////////////////////////////////////*
P #getDate          B                   EXPORT                     
 *--------------------------------------------------------------*
D #getDate         PI              *                              
D  parm1                         4                               
D  parm2                         4                               
D  parm3                         9  0                 
 *--------------------------------------------------------------*
C                   //put calcs in here

C                   return    ??                         
 *--------------------------------------------------------------*     
P #getDate        E                                                

Aaron Bartell              
+---
| 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 ...

Follow-Ups:

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.