Re: Calling an ile rpg service program procedure that returns a value from a java class

cesco via RPG400-L <[email protected]> Fri, 15 May 2026 09:23:06 +0000 (UTC)
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
Ciao Luca,
It's been a lot since I've coded some calls into RPG via jt400 (too clunky), but apparently you cannot return chars, check docs.
https://www.ibm.com/docs/api/v1/content/ssw_ibm_i_74/rzahh/javadoc/com/ibm/as400/access/ServiceProgramCall.html#setReturnValueFormat(int)
If you really want to go that way you need to lift the return into a parameter (explicitely or via RTNCODE maybe) or just a wrapper.

Maybe an idea is to use simple database access to expose such data, i.e. stored procedure that you can reuse than universally (JDBC from java, ODBC etc.).

ciao









On Friday, May 15, 2026 at 09:37:51 AM GMT+2, Luca Giammattei <[email protected]> wrote: 





Sorry if the subject is off topic but I don't seem to find any help anywhere so 
I thought I just I'm gonna write it here and see what happens.

I'm stuck with what I thought was a small problem but can't seem to resolve.
From a Java class running on a Windows server, I need to:
1. connect to a certain IBM i power server; (done)
2. set a specific library list with a given custom command; (done)
3. call a service program procedure that returns a char(6) value. (And here I'm 
stuck.)
Despite several attempts, the procedure, assuming it's actually executed, 
doesn't produce any results.
This is the RPG prototype of the procedure:


dcl-pr RtvSupplierCode Char(6) EXTPROC('RtvSupplierCode');
codMec zoned(7:0) const options(*omit:*nopass);
vatCode char(16) const options(*omit:*nopass);
idColCode packed(13:0) const options(*omit:*nopass);
end-pr;

The returned char(6) field may also be empty.
The three parameters are alternative; those not passed must be marked with the 
*OMIT placeholder.
The possible values for the test are:
codMec=some numbers or vatCode=some numbers but as a string or idColCode=again 
some numbers

Normally, the call in rpgile would be
supplierCode = RtvSupplierCode(1236547 : *omit : *omit);
supplierCode = RtvSupplierCode (*omit : '123456789012345' : *omit);
supplierCode = RtvSupplierCode (*omit : *omit : 12345);

Now on my class It just doesn't seem to work. The call is done without any pcml 
support.

Has anyone ever used this call?
Does anyone have any working code examples I can try?
Except for the example included in the source comments of the ServiceProgramCall 
class, I haven't found any other examples of this.
Can anyone point me to some info?
Thanks in advance for your attention.
-- 
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.

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

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.