Forgive me if I don't say this quite right.
I have a stored procedure that "calls" an RPGLE program in which a dynamic SQL statement is used. When I run and debug from the Iseries (calling the RPGLE program directly), everything works great. However, when I ran a debug while my coworker was running his VB code (from Access), it clearly showed a -206 error on the PREPARE. My local guru isn't sure why. We tried a simple recompile and remigrate (we use Rocket Aldon LMI) and that didn't help.
Now, on Monday we're going to sit down together (me, the coworker and the guru) and see what we can see, but I was wondering if anyone had any ideas
Here is my code for the PROCEDURE:
Here is part of my code for the RPGLE (please ignore my "newbie notes"). %Trim(SQLString) holds 'SELECT * FROM <filename> ' because <filename> changes and is set up immediately before this code.
My code goes on to do a FETCH and then an UPDATE (after a second setup and PREPARE so I UPDATE the right file).
Thank you for any assistance. Have a good weekend.


I have a stored procedure that "calls" an RPGLE program in which a dynamic SQL statement is used. When I run and debug from the Iseries (calling the RPGLE program directly), everything works great. However, when I ran a debug while my coworker was running his VB code (from Access), it clearly showed a -206 error on the PREPARE. My local guru isn't sure why. We tried a simple recompile and remigrate (we use Rocket Aldon LMI) and that didn't help.
Now, on Monday we're going to sit down together (me, the coworker and the guru) and see what we can see, but I was wondering if anyone had any ideas

Here is my code for the PROCEDURE:
PHP Code:
CREATE OR REPLACE PROCEDURE &LIB/LBLFLPPR (IN INLOC CHAR (06),
IN INTYPE CHAR (01),
IN INDATE NUMERIC (7, 0),
IN INTRKGRP NUMERIC (2,0),
IN INFLENO NUMERIC (2,0),
OUT OUTMSG CHAR (30))
LANGUAGE RPGLE SPECIFIC &LIB/LBLFLPPR NOT
DETERMINISTIC MODIFIES SQL DATA
CALLED ON NULL
INPUT EXTERNAL NAME &LIB/LBLFLGPR
PARAMETER STYLE GENERAL
*===========================================================
PHP Code:
//a field holds the SQL statement (don't use colons on the
//variables, WKTICK is used to put tick marks around characters
SQLString = %Trim(SQLString) + ' WHERE SADPPRILOC = ' +
WKTICK + INLOC + WKTICK +
' AND SADRECTYPE = ' +
WKTICK + INTYPE + WKTICK +
' AND SADLDATE = ' + %CHAR(INLOADDTE) +
' AND SADFTRKGP = ' + %CHAR(INTRKGRP) ;
//Prepare Statement -this "creates" SQLSTM which is
// the SQL statement written into SQLSTRING
EXEC SQL
Prepare SQLSTM from :SQLSTRING;
IF SQLCOD <> 0 ;
LOOPEND = 'Y';
ENDIF;
// DECLARE CURSOR - have to do this with a SELECT anytime
// you are doing dynamic SQL
Thank you for any assistance. Have a good weekend.





Comment