Hi,
I'll just start my answer by pointing out that at this time of the year, answers can be slow, as those in the Northern hemisphere take their summer holidays. So someone might have the answer you want in a few weeks time when they return from holiday
You've raised two interesting issues when using SQL Server
1. Can you choose, and if so how, when to use a Server side cursor versus a Client side cursor?
2. For queries returning multiple rows, based on what is entered in the 4gl code, what type of cursor is created on the SQL Server database? We can see that when using SCROLL CURSOR, SQL_ATTR_CURSOR_SCROLLABLE is set to SQL_SCROLLABLE
https://4js.com/online_documentation/fjs-fgl-manual-html/#c_fgl_odiagmsv_046.html. So the question maybe what is set for non SCROLL cursors? Is that set back to SQL_NON_SCROLLABLE?
However I wouldn't expect anything we are doing, or not doing with the above, to explain why something in your words "should take seconds, takes hours", unless your database is operating at or near capacity
What I would encourage you to do if you have not done already is to ...
use FGLSQLDEBUG environment variable to determine the SQL statement as executed, this output will show the SQL statement from the 4gl code, and the SQL statement that is then passed to the database
make sure you are aware you can pass non-Informix SQL statements to the database.
You aren't repeatedly creating cursors inside a loop, a common thing I used to see that impacts database performance. declare the cursor once outside the loop and re-use it
try your code with Genero instead of the old BDS. I'm not promising any improvement but there are many years of development difference, and there could potentially be an improvement in place already that you are missing out on by sticking with the old BDS.
Reuben