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



Peter,

That doesn't work if you're using callbacks since you call it via a
"generic" name.

d ProcToCall pr extprc(ptrProcToCall)
d parm1 10a const

p MyProc
d MyProc
d parm1 10a const
d myProcPtr * procptr
/free
ptrProcToCall = myProcPtr;
ProcToCall(parm1);
return;
/end-free



The originating program could have something like so

d Proc1 pr
d parm1 10a const

d Proc2 pr
d parm1 10a const

d Proc3 pr
d parm1 10a const


//Begin Mainline
/free
select;
when someStatus = 'A';
MyProc('STATA':%paddr(Proc1);
when someStatus = 'B';
MyProc('STATB':%paddr(Proc2);
when someStatus = 'C';
MyProc('STATC':%paddr(Proc3);
endsl;
return;
/end-free

HTH,

Charles

On Fri, May 8, 2009 at 9:35 PM, Peter Connell
<Peter.Connell@xxxxxxxxxxxxxxxxx> wrote:
I always code prototypes only once at their place of origin, in the
source for the *SRVPGM.

e.g. In the *SRVPGM

/IF NOT DEFINED(Copying_MYSRVPGM)
H     NoMain
* Exported prototypes
....
/IF DEFINED(Copying_MYSRVPGM)
/EOF
/ENDIF
....

And in the *PGM which binds to it -
.....
/define Copying_MYSRVPGM
/copy MYSRVPGM
.....

I believe Barbara suggests something similar.

Peter

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Saturday, 9 May 2009 6:52 a.m.
To: RPG programming on the IBM i / System i
Subject: Re: Call back procedures

I've written massive amounts of code using call-backs.  They are a good
way to write tools intended for programmers, allowing those programmers
to insert their own code at key points in the process.  Making things
much more flexible (usually at the cost of complexity)

The only real gotcha that I know of with callbacks themselves is that
you end up defining the prototype for the procedure twice, and there's
no system-provided tool that verifies that the prototypes match.  Thus,
it's relatively easy to have parameter mismatches (much like the old
CALL/PARM/PLIST opcodes -- you eschew many of the advantages of
prototypes)

Other than that... it's hard to find a "gotcha".  I mean, callbacks are
plumbing.  They are a way to call a routine.    Sometimes they are the
right tool for the job, and sometimes they are not.  But without any
context, it's hard to list "gotchas" or "should-a/could-a".

So... what do you plan to do with your callback?


Rick.Chevalier@xxxxxxxxxxxxxxx wrote:
I think we may have encountered a situation in our shop where call
back procedures would be helpful.  I recently read an article by Joe
Pluta describing the concept and it makes sense to me.  My question
is does anyone have real world experience with call back procedures
that would be willing to share any gotcha's or I wish I had done this
experiences?

I would like to find out about them now while we are still designing
rather than later.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

#####################################################################################
This correspondence is for the named person's use only. It may contain confidential or legally privileged information, or both. No confidentiality or privilege is waived or lost by any mistransmission. If you receive this correspondence in error, please immediately delete it from your system and notify the sender. You must not disclose, copy or rely on any part of this correspondence if you are not the intended recipient. Any views expressed in this message are those of the individual sender, except where the sender expressly, and with authority, states them to be the views of Veda Advantage. If you need assistance, please contact Veda Advantage on either :- Australia 133124 or New Zealand +64 9 367 6200
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.