View Full Version : using prototyped calls in free-format rpg
01-03-2002, 06:21 AM
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.
01-23-2002, 07:07 AM
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... <center> Call pgmVariable pgmPlist </center> Any thoughts or comments would be greatly appreciated. Thanks, Brandon
01-23-2002, 07:07 AM
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 value <center> Return %paddr(procName) </center> p GetProcPtr e
01-23-2002, 12:25 PM
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/Resources/ClubTech/TNT400/bo400ng/ilerpgmodule.htm.
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.