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



Igor.Beslic@xxxxxxxxxxxx wrote:
> 
> I have problem with calling rpg servicePGM subProc that has *NOPASS parm
> in prototype. The problem is in third parameter. If called from other RPG
> program subProcedures %PARMS BIF works as expected. But if I pass
> parameters from Java program, %PARMS bif returns 2 althought  I passed 3
> parameters.

RPG depends on an operational descriptor to get the %PARMS value.  RPG
doesn't pass a _full_ operational descriptor unless OPDESC is coded, but
it always passes a mini operational descriptor, which gives it the
number of parameters.

When you call RPG from other languages, you have to make sure they pass
the operational descriptor.  CLLE always passes a full descriptor, but
you have to tell C and COBOL to pass one.  

Unfortunately, RPG can't always tell that it didn't get an operational
descriptor, so it might give you garbage for %PARMS rather than the -1
value it gives when it knows it didn't get the descriptor.

Even more unfortunately, there's no way to ask Java to pass an
operational descriptor.  If you still want the *NOPASS function for your
non-Java callers, you'll have to create another procedure for Java to
call, maybe with some special "parameter-not-passed" value, or maybe
with an extra (first) parameter giving the number of other parameters. 
Then your other procedure can call through to your real procedure:
   if numparms = 2
        callp otherproc(p1 : p2)
   else
        callp otherproc(p1 : p2 : p3)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.