Re: open cursor ==> error -255/0
Posted in 1997
Jacob Salomon <jake@apparel.net> wrote: ...snip... :Nils Myklebust wrote: :--SNIP-- :> :542 whenever error continue # For debugging :> :543 :> :544 close pkey_curs # This was opened in llh_a_construct :> :545 open pkey_curs # reopen it for fresh business :> :546 while sqlca.sqlcode = 0 :> The first time this sqlcode is from the above open statement which is :> ok. The next time arround it's from the clos lh_cursor just before the :> end while. That I assume is not the idea. :> :547 fetch pkey_curs :> :548 into m_oordrh.ord_num # Just get the primary key value :> You may use: :> if sqlca.sqlcode <> 0 then :> exit while :> end if :> to get out of the while loop. : :Actually, Nils, this code was working without a problem; Yes I understod that it was "working". I included this part only to make you aware of the fact that it doesn't seem to work as intended. As originally written it tested on the sqlca.sqlcode value from the wrong statement (the close at the end of the while loop). Your program would try to fetch beyound the last row of the pkey_curs without any testing on that fact. : it was ONLY the :following line that blew up in my face: :> :549 open lh_cursor :> :550 using m_oordrh.ord_num : :The above was getting the -255 error. ...snip... :I need to be *in* a transaction in order to open a locking cursor. I should of course have thought of this as well, but sometimes it isn't easy to se the obvious as you have experienced. Nils.Myklebust@idg.no NM Data AS, P.O.Box 9090 Gronland, N-0133 Oslo, Norway My opinions are those of my company The Informix FAQ is at http://www.iiug.org