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.
As an Amazon Associate we earn from qualifying purchases.