"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> wrote on 01/15/2020
01:43:10 PM:
Okay, I am truly lost here. I am missing something really simple.
this is a quick test program that fails when called by the exit with
RNQ0115 when it does the upper=sqlstuff

RNQ0115 is Length of varying length variable is out of range.

**FREE

/copy qsysinc/qrpglesrc,ezdaep
Dcl-s pEZDQLSTL pointer inz( %Addr( EZDQLSTL ) );

Dcl-s SQLStuff VarChar(32000: 4) Based( pEZDQLSTL );

Dcl-s Upper Varchar(128);

dcl-pr ODBCEXIT extpgm('ODBCEXITN');
allow char(1);
datain likeds(EZDSQLF2);
end-pr;

dcl-pi ODBCEXIT;
allow char(1);
datain likeds(EZDSQLF2);


allow = *on;
Upper = SQLStuff; // This will truncate to 1024 if needed.

*inlr = *on;

return;


OK, here is the problem... I don't know if anyone already made
this clear, but... You pointer is based on storage that is in your
program -- rather than on storage that is passed to you by the exit. At
least, I presume you're trying to reference storage that will be passed to
you in a normal situation.

The above code appears to be standalone (which doesn't accurately
represent the situation you're trying to deal with). Meaning, you're not
actually calling ODBCEXIT in this sample code. So... The EZDQLSTL data
structure is always going to have invalid data in it in this situation.

What I would expect to see is a pointer to the "datain" parm --
unless your plan is to pass the data structure *from* your program *to*
that API. In that case, your pointer is fine but your assignment
statement is out of place (Upper = SQLStuff) since you didn't actually
call the API in the sample code.

Are you following me?

Sincerely,

Dave Clark

This thread ...

Replies:

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