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



You gotta love trial and error....

The host variables were going to be passed pack to the caller in a Plist and that is where they were defined. However, the SQL fetch didn't like dumping them into Plist variables.

Defining the host variables in the D Specs fixed the problem. I set the Plist values from the host variables retrieved.

Pete Helgren
Value Added Software, Inc
www.asaap.com
www.opensource4i.com


On 2/9/2011 3:42 PM, Pete Helgren wrote:
This one has me stumped. I have a prepared statement that selects a row
based on parameter values. The sql looks like this:

gSQLStmnt2 = 'select distinct extord, lprod, lqord, ' +
'substr(extvin,1,10) from ecl ' +
'inner join eclx01 on lord=extord and lline=exline ' +
'where lprod = ? and extvin = ? ';

I then do the following in another sub procedure:

c/free
EXEC SQL
PREPARE S2 FROM :gSQLStmnt2;
EXEC SQL
DECLARE C2 CURSOR FOR S2;
EXEC SQL
OPEN C2 USING :ItemNum, :Vin;
/end-free

When I run the program the joblog shows this:
.......
Blocking used for query.
Cursor C2 opened.
1 rows fetched from cursor C2.
Pointer not set for location referenced.

That MCH3601 occurs on this fetch:

FETCH FROM C2 INTO :order#,:Item,:QTY,:vin#;

This is the first time I have used a parameterized SQL statement in an
RPG program so I have probably done something wrong. The compiler
listing shows this at the statement the error points to:

451 C SQL_00032 IFEQ '1'
452 C EVAL ORDER# = SQL_00034
453 C EVAL ITEM = SQL_00035
454 C EVAL QTY = SQL_00036
455 C EVAL VIN# = SQL_00037
456 C END

It is almost as though it doesn't like the host variables. I double
checked the sizes and types of the variables and they *seem* OK.

Anybody seen something like this before and can point me to my error?


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.