Just use your variable in the EXTPGM keyword. And if you use CALLB with a procedure pointer, specify the proceure pointer in the EXTPROC keyword.
Just use your variable in the EXTPGM keyword. And if you use CALLB with a procedure pointer, specify the proceure pointer in the EXTPROC keyword.
I'm trying to use free-format rpg in my new developmentand have run into a problem. I was wondering if it's possible to use a variable for the name of the pprototypedcall. The interface is the same for all pgms that will be called via this method. /free callp someVariablePgmName(pString); /end-free Normally I would handle it this way...Call pgmVariable pgmPlist Any thoughts or comments would be greatly appreciated. Thanks, Brandon
Thanks Barbara, That worked great for what I was doing in that pgm. How about if I wanted to load a procedure ptr with the address of a procedure that is named in a variable. I'm trying to create a generic service pgm that would be bound to any pgm that would need to call a procedure. My hope is: a. easier maintenance for programming b. dynamic binding occuring at time of procedure call If you couldn't tell, I'm kinda new at ILE programming, but I'm trying... Here's the code that doesn't work since %paddr wants a literal as a parm. h NoMain /Define cpyprocptr /copy qrpglesrc,prototypes *================================================= =============== * Return a pointer to a procedure that is input *================================================= =============== p GetProcPtr b Export d GetProcPtr pi * d procName 30 valueReturn %paddr(procName) p GetProcPtr e
That's not so easy. If you know the possible values when you're writing your program, the easy way is to use a SELECT statement. C select C when name = 'A' C eval pptr = %PADDR('A') Otherwise, as long as the procedure is in a service program, there's a way to get the procedure pointer just from the names of the service program and procedures, using system APIs QleActBndPgm, QleGetExp, and rslvsp. Look here for an example http://www.iseriesnetwork.com/Resour...erpgmodule.htm.