h***@dartcontainer.com
2006-03-06 20:47:08 UTC
I have a stored procedure calling an external program. This cursor it
creates is dynamic in that the files and libraries are changed. The
first time I call this sp, it works fine. After that, I cannot change
the files or libraries. It gives me an error saying it cannot find a
field from the original run. It is like it is keeping the original
creation of the cursor.
Can anyone point me in the right direction?
Here is my code.
Stored Proc:
CREATE PROCEDURE HMPGMR/DCTP001
(IN Library CHARACTER(10),
IN Member CHARACTER(10),
IN Report CHARACTER(10),
IN User CHARACTER(10),
IN RunNumber DECIMAL(6,0))
DYNAMIC RESULT SETS 1
EXTERNAL NAME HMPGMR/DCRP001
LANGUAGE RPGLE
RPGLE (just the embedded sql):
C/EXEC SQL
C+ PREPARE DYNSQLSTMT
C+ FROM :SQLSTMTSTR (sqlstmtstr is a valid sql string)
C/END-EXEC
* Declare the Cursor
C/EXEC SQL
C+ DECLARE DataCursor1 DYNAMIC SCROLL CURSOR WITH RETURN FOR
C+ DYNSQLSTMT
C/END-EXEC
C/EXEC SQL
C+ OPEN DataCursor1
C/END-EXEC
C/EXEC SQL
C+ Set Result Sets Cursor DataCursor1
C/END-EXEC
creates is dynamic in that the files and libraries are changed. The
first time I call this sp, it works fine. After that, I cannot change
the files or libraries. It gives me an error saying it cannot find a
field from the original run. It is like it is keeping the original
creation of the cursor.
Can anyone point me in the right direction?
Here is my code.
Stored Proc:
CREATE PROCEDURE HMPGMR/DCTP001
(IN Library CHARACTER(10),
IN Member CHARACTER(10),
IN Report CHARACTER(10),
IN User CHARACTER(10),
IN RunNumber DECIMAL(6,0))
DYNAMIC RESULT SETS 1
EXTERNAL NAME HMPGMR/DCRP001
LANGUAGE RPGLE
RPGLE (just the embedded sql):
C/EXEC SQL
C+ PREPARE DYNSQLSTMT
C+ FROM :SQLSTMTSTR (sqlstmtstr is a valid sql string)
C/END-EXEC
* Declare the Cursor
C/EXEC SQL
C+ DECLARE DataCursor1 DYNAMIC SCROLL CURSOR WITH RETURN FOR
C+ DYNSQLSTMT
C/END-EXEC
C/EXEC SQL
C+ OPEN DataCursor1
C/END-EXEC
C/EXEC SQL
C+ Set Result Sets Cursor DataCursor1
C/END-EXEC