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:


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.

This thread ...


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

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