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



Hey Richard;

Thanx for your interest - I just carved this out for you;


Here is the prototype;

///
// Programs and procedures : Load service program procedure as procedure
pointer
//
//
// @param (input) Library where the ILE service program exists or *LIBL
// @param (input) Program name of the ILE service program
// @return procedure pointer or null and wrap it in a MONITOR
//
///
Dcl-PR json_LoadServiceProgramProc pointer(*proc) extproc(*CWIDEN :
'jx_loadServiceProgramProc');
library char(10) const;
program char(10) const;
procedure pointer value options(*string);
End-PR;


Example of usages:

dcl-proc callNameAndAge;

dcl-pr NameAndAge pointer extproc(pNameAndAge);
name char (10) const;
text char(200);
age packed(5:0);
end-pr;

dcl-s text char(200);
dcl-s age packed(5:0);
dcl-s msg char(50);

dcl-s pNameAndAge pointer (*PROC) static;

pNameAndAge = json_loadServiceProgramProc ( '*LIBL' : 'HELOSRVPGM' :
'NAMEAGE');
if pNameAndAge = *null;
json_joblog('Could not load program HELOSRVPGM');
return;
endif;

// Now we have an efficient dynamic procedure pointer to the service
program
// We can call it with the parameters we want,using prototype
// Note that text and age parameters are passed by reference, so we can
change them
text = 'Hello world from RPG';
age = 55;
NameAndAge ('Niels': text: age);
json_joblog ('Called HELOSRVPGM/NAMEAGE returns: "text": ' +
%trim(text) + ', "age": ' + %char(age));

end-proc;


You can find it here - where you also can see how it is implemented;

https://github.com/sitemule/noxDB/blob/master/headers/JSONPARSER.rpgle

Search for: json_LoadServiceProgramProc

This program examples/JSONPGM02B show how to use it:

https://github.com/sitemule/noxDB/blob/master/examples/JSONPGM02B.Call-ILE-service-program-procedure-by-proc-pointer.rpgle




On Sun, Mar 22, 2026 at 4:56 PM Richard Schoen <richard@xxxxxxxxxxxxxxxxx>
wrote:

Ooh I'll have to check out the dynamic loading in noxDb.

Thanks for reminding me. I hadn't looked at that in a while.

Regards,
Richard Schoen
Web: http://www.richardschoen.net
Email: richard@xxxxxxxxxxxxxxxxx

----------------------------------------------------------------------

message: 1
date: Sun, 22 Mar 2026 17:14:12 +0800
from: Niels Liisberg <nli@xxxxxxxxxxxxxxxxx>
subject: Re: RPG Service Program vs Include Source for Shared
Subprocedures and SQL Calls

Hey Brian,

We did it manually- so each ?breaking? version got its own version
signature- and it worked fine. The problem occurred when you have hundreds
of versions- and trying to keep track of each.. with hundreds of exports..
the binder source exploded..

So we went to a more pragmatic solution: only adding exports to the end -
and if implementation is challenged- add that to the end and don?t touch
the original so any client code will work in touched.

.. but that is a convention, and conventions can easy be broken.

That made me implement the dynamic procedure load and we use that in all
our products and projects

You can find ?the magic? in both noxDb and ILEastic and in our IceBreak.


--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.



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