×
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 John,
I wrote a ReturnCount() procedure for our RPGLE "Toolbox" service
program. Pass it an SQL 'from-where' string and it uses SQLCLI to
return the count(*) as an integer. It works great when called from
RPGLE but CLLE refuses to recognize the integer
I think the crux of the problem is that *CHAR variables are handled
differently than numeric variables under the covers. So if RPG returns
an integer, and CL receives a *CHAR, the two won't be compatible, and
will cause problems.
The fix is actually pretty easy... just wrap the RTNVAL with %BIN() so
that CL knows that it's an integer.
For example:
CALLPRC PRC('RETURNCOUNT') PARM((&SQLSTMT) (&PGMRC) (&PGMMISC)) +
RTNVAL(%BIN(&HEXINTEGER))
The %BIN() function tells CL that it's an integer, so theoretically this
will work (though, I'll let you test it, I'm not going to try to
compile/run your code, I'm a bit short on time.)
Note that starting with V5R3, there's an *INT data type in CL. If you
use that, you shouldn't need to use %BIN.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.