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



Tom, Scott,

Bingo! defining RTNVAR as *INT did the trick. The pre V5R1 method of
RTNVAR(%bin(&hexinteger)) still works, too.

I'd have never thought to code the %bin inside of the RTNVAR(). Dunno,
guess I'd rather look at two lines of code because an array of nested
parens is harder to read and maintain six-months after I've totally
forgotten the details of a particular program.

But coding it that way must tell the calling mechanism to behave
differently because RTNVAR(%bin(&hexinteger)) is definitely not the same
as looking at the %bin() of RTNVAR(&hexinteger). And not just because
RTNVAR(&hexinteger) needs to be viewed as hex data, the chunk o' memory
returned to the CLLE program is literally different.

Many thanks, JK

On Wed Oct 10 15:49 , Tom Liotta sent:

johnking@xxxxxxx wrote:

> I know that CLLE doesn't exactly understand integers, but I was under
the
> impression that RTNVAR could be retrieved in a *CHAR variable and
treated with
> the %bin() function.
> Any suggestions will be most welcome. JK

John:

My first suggestion would be that ILE CL has understood *INT
variables for a while now. If you're working in V5R1 or earlier,
then I understand. I'm no longer certain about V5R2, though I can
compile on V5R3 back to V5R2 and use *INT variables.

Therefore:

> DCL &SQLStmt *CHAR 1024
> DCL &hexinteger *int 4 <=== Change to *INT (4)
> ChgVar &SQLStmt ('select count(*) from SOMETABLE where
SOMEFIELD = ''FOO'' ')
> CALLPRC PRC('RETURNCOUNT') PARM((&SQLSTMT) (&PGMRC) (&PGMMISC))
> RTNVAL(&HEXINTEGER)

If that change can't be made, my coding used to be like this:

> DCL &SQLStmt *CHAR 1024
> DCL &hexinteger *CHAR 4
> ChgVar &SQLStmt ('select count(*) from SOMETABLE where
SOMEFIELD = ''FOO'' ')
> CALLPRC PRC('RETURNCOUNT') PARM((&SQLSTMT) (&PGMRC) (&PGMMISC))
> RTNVAL( %bin( &HEXINTEGER ) ) <=== Change to add %BIN()

The %bin() BIF always did the appropriate work to give a *CHAR 4
result. I never looked into why it worked as it did. It somehow
always seemed backwards. But since it worked, I had no reason to
look beyond it.

Tom Liotta

--
Tom Liotta
The PowerTech Group, Inc.
19426 68th Avenue South
Kent, WA 98032
Phone 253-872-7788 x313
253-479-1416
Fax 253-872-7904
http://www.powertech.com

---- Msg sent via Internet America Webmail -
http://www.internetamerica.com/

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.