|
On Thu, 4 Jan 2001, Eric N. Wilson wrote:
> Hello everyone,
>
> I am trying to figure out if there is a way to implement call backs
> with the EVAL/CALLP model rather than the CALLB model.
>
Sure, there's a way... unfortunately, there's no good way to implement a
"header file" containing the prototype for the callback procedure (that I
know of) but... you can certainly do a callback without using CALLB.
Here's a trivial example:
Source Member: QRPGLESRC, FOREACH_H
D ForEach PR
D proc * procptr value
Source Member: QRPGLESRC, FOREACH
* Compile me with:
* CRTRPGMOD FOREACH SRCFILE(xxx/QRPGLESRC) DBGVIEW(*LIST)
* CRTSRVPGM FOREACH EXPORT(*ALL) ACTGRP(*CALLER)
H NOMAIN
D/COPY QRPGLESRC,FOREACH_H
P ForEach B Export
D ForEach PI
D proc * procptr value
D CallMeBack PR ExtProc(proc)
D Counter 10I 0 value
D X S 10I 0
C do 10 X
c callp CallMeBack(X)
c enddo
c return
P E
Source Member: QRPGLESRC, TESTFOR:
** Compile me with:
** CRTRPGMOD TESTFOR SRCFILE(xxx/QRPGLESRC) DBGVIEW(*LIST)
** CRTPGM TESTFOR BNDSRVPGM(FOREACH) ACTGRP(*NEW)
D/COPY QRPGLESRC,FOREACH_H
D DsplyNum PR
D Num 10I 0 value
C callp ForEach(%paddr('DSPLYNUM'))
c eval *inlr = *on
P DsplyNum B Export
D DsplyNum PI
D Num 10I 0 value
C dsply Num
c return
P E
+---
| 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 mailing list archive is Copyright 1997-2025 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.