Richard,
Well, first I'm glad I could help. But, I didn't really mean for
you to use the OPEN to patch the error. I was hoping that you could use
the OPEN to find out what error the open portion of the FOREACH was
getting. That error was masked by the fetch portion of the FOREACH which
returned you your original -400.
From your message, it sounds like your cursor was being closed. I'm
not sure, though, whether the WITH HOLD or the OPEN fixed your
problem. But, if you're happy with the way things stand then
congratulations!
--Craig (craig@chemistry.utah.edu)
>
> Thanks for your help. I was getting a different error when I had the WITH HOLD
> option on -246, ISAM -101, file not open (but only when I had Inserted into the
> table). I thought the WITH HOLD was masking the real error, but I think you are
> right - I need the WITH HOLD.
>
> I tried your idea about explicitly opening the cursor and, guess what, it worked
> and no more errors ! I have left it in the production version of the code with a
> huge comment warning future maintainers not to take it out.
>