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



Hi Jon,

>  >> Unfortunately, RPG doesn't offer us a "LikePrototype" keyword
> 
> It kinda does - at least as far as the proc ptr 
> initialization is concerned.
> The support was added in ???? hmmm - can't recall.  Maybe V4R4?
> If you combine this with a procptr on the prototype (as in 
> CallThis below) you can get close to what you seem to be 
> after.  Or have I missed the point?
> 
>      d ppr1            s               *   procptr inz(%paddr(pr1))
>      d ppr2            s               *   procptr inz(%paddr(pr2))
> 
>      d ppr             s               *   procptr
> 
>      d pr1             pr
> 
>      d pr2             pr
> 
>      d CallThis        pr                  ExtProc(ppr)
> 
>       /Free
>          ppr = ppr1;
>          CallThis();  // calls pr1
>          ppr = ppr2;
>          CallThis();  // calls pr2


The code example you've provided will work, but the trouble is that you need
to define the same prototype multiple times, so change management becomes an
issue. What LIKEPR would give us is the following


Source member: CUGLS001PR (Prototypes for service pgm CUGLS001)

D CUGLS001_getPeriodStatus...
D                 pr              10a
D  iCompany                                      like(t_Company)
D  iPeriod                               like(t_fiscalPeriod)
D  iSubledger                              like(t_ledgerCode)
options(*nopass)


Source member: CUGLE001 (Some pgm that uses CUGLS001)

/copy CUGLS001PR

 // define alias names for srvpgm procedures
D getStatus        pr                    extproc('CUGLS001_GETPERIODSTATUS')
D                                      likepr(*EXTPROC)


That's essentially what I was hoping to achieve.


Regards,

John Taylor






















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.