I have an SQLRPGLE program which accepts the SQL statement as an input parameter to the program from an RPGLE program. (The SQL is entered by user .) My intention is to validate the SQL and make a prepare statement out of it, and then initiates a Fetch Next from C1 into a :wSTR. Check for the SQLCOD to determine whether the SQL is valid. IF valid i will display the result to user by moving the wSTR value to a display file field(of length 350A). If I enter a correct SQL I will get the result, if for the second time I enter some irrelevant values, I am still getting the previous output. I am closing the cursor at the end and also at the beginning of the program. I am clearing the field wSTR also. In debug before the prepare statement I can see wSTR as blanks. But after the fetch, though the SQL is bad, it returns the previous output ans SQLCOD as Zeros. This looks very strange. Please help me to figure out the issue.
February 1, 2013 5:10 AM
February 1, 2013 1:09 PM