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