I have a problem with SQL cursors being left open, even after the "close cursor" instruction has been executed successfully (SQLSTT = '00000') from within an RPGIV program. There are 2 cursors within the program: 1 cursor is used for fetching the count of selected records, the other is a dynamic scroll cursor for fetching the actual detail information. The SQL is working fine; I am getting the results I expect. However, when the program ends, the queried file is sometimes still open when I do a DSPJOB, and there may be several occurrences of it under open files. I have gone so far as to put extra "close cursor" instructions for each of the 2 cursors when the program ends, but the file still shows as open. Any ideas what I am missing?
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!