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



Hi Kurt,


I have a procedure that returns a 1A value and is called by a CL.
The CL's variable is defined as *CHAR and LEN(1). The procedure
prototype does not have ExtProc(*CL). So, why is the program
working? I've debugged it and saw that it is getting the correct
value.


I wouldn't rely on that behavior. You may just be "getting lucky". Or, it may be working today, and may fail in the future. Until IBM tells us that this approach is okay, we should stick to using ExtProc(*CL)


I went in and changed the variable in CL to be 2 bytes, per a number
of postings I found on the web as a workaround,


At one time, this was even published as a workaround in the IBM manuals.

BUT... don't use this technique anymore! This technique worked only in V5R4 and earlier releases. IBM documented this as a "change in behavior" in the IBM i 6.1 Memo to Users as a behavior change in ILE. It will not work after V5R4.

It's much better to fix it properly, and add ExtProc(*CL)

If you have a lot of existing callers (routines calling the subprocedure) and are reluctant to make a change that requires recompiling all of those callers, then use a wrapper routine.

Wrapper example... let's say you have an existing routine called TheProc() that's called by many RPG programs (that you don't want to recompile):

D TheProc PR 1a
D SomeParm 22a const


Now you want to create a wrapper. A Wrapper is a simple subprocedure that does nothing else besides change/fix the parameters, and call the original procedure. So you might have this:

D TheProcCL PR 1a extproc(*CL:'THEPROCCL')
D SomeParm 22a const
.
.
D TheProcCL PI
D SomeParm 22a const
/free
return TheProc( SomeParm );
/end-free

CL programs can call TheProcCL, and will work nicely because it has been coded with ExtProc(*CL). The existing RPG callers don't have to change, and can keep calling TheProc() as before.

-SK

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.