Losing cursor in Informix 4GL
Posted in 1992
The following is a part of a 4GL program I am developing at the
moment (with some difficulties!),
main program
let select_stmt = "select .. from taba, tabb, tabc...."
prepare y from select_stmt
declare x scroll cursor with hold for y
open x
fetch first x into <variables list..>
call a(...)
while not done
fetch next x into <variables list..>
if < conditions > then
call b(..)
else
call a(..)
end if
end while
function a(..)
insert into tabe values(.....)
end function
function b(..)
update tabe set ......
where < conditions >
end function
Note that this is only a simplified version, the full version has
more than one prepare statements and cursors. I did make sure
all prepare statement ids and cursors are unique even across modules.
MY PROBLEM: I need to use begin work and commit work around insert
and update in function a and b respectively otherwise a fetch (not
necessary the first fetch, usually after certain amount of fetches)
in main causes the program to crash with the following message
SQL Statement error number -565
Cannot read sorted rows
SYSTEM error number -101
ISAM error: file is not open.
Can someone clarify what is causing this??? Note that I also
have closed and freed resources used by cursor and prepare wherever
possible.
+--------------------------------------------------------------------+
Ron Lees rlees@pdact.pd.necisa.oz.au
NEC Information Systems Australia Pty Ltd Voice: +61-6-2516411
Software Development Centre (Canberra) Fax: +61-6-2516947
PO Box 244, Belconnen ACT 2616, AUSTRALIA
+--------------------------------------------------------------------+