× 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 guys,

I have a strange case in an SQLRPGLE program. Here is my example code, to eventually reproduce this:

**free
ctl-opt actgrp(*new);

dcl-s bBool ind inz(*on);
dcl-s sVar varchar(100) inz('Hello');
dcl-s nCount int(10) inz;

prTest();
prTest();

*inlr = *on;
return;

dcl-proc prTest;
exec sql select count(*)
into :nCount
from sysibm.sysdummy1
where ' ' = :sVar and :bBool ;
return;
end-proc;

When running/debugging the program, the SQLCODE is *ZERO after the first procedure call.

But after the second procedure call, the SQLCODE is -311, which means "Length in varying-length, LOB, or XML host variable not valid".

If I remove either the Boolean or the Varchar variable from the statement, it runs fine. Changing ":bBool" to ":bBool = '1'" or anything else doesn't help.

If I add the line

sql_00004 = *blank;

just before the EXEC SQL it runs also fine. This is the buffer before the VARCHAR field in the SQL host variables DS, that the Pre-Compiler defines. And the content of this "buffer" is the only thing that differs from call 1 to call 2.

But this shouldn't happen? Or should it? What am I doing wrong?

From what I can see, it happens only, if the program was compiled on 7.5. If it was compiled on an earlier release, it seems to run fine on 7.5.

TIA for every hint.
Daniel

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.