Coding 'n stuff
Improving cursor performance
In NetCOBOL for .NET v3.1 you can get fast forward, read-only cursors provided you configure the ODBC settings in your configuration file accordingly. By default, all cursors will be read only. Unfortunately, many people use cursors for updating as well, and usually get this to work by changing the @SQL_CONCURRENCY option to something other than READ_ONLY. This option will affect all cursors in the application, and turn read only cursors into dynamic ones (which perform much slower than their read only counterparts).
You can get around this by using SQL Options in the NetCOBOL configuration section. Basically you create two options, one for read only cursors, and the other for updatable cursors. Then, set the @SQL_ODBC_CURSOR_DEFAULT and @SQL_ODBC_CURSOR_UPDATE settings to point to these two options so that NetCOBOL can pick the correct SQL Option depending on the cursor type. You are probably asking: How does it know what type the cursor is? The answer is that it looks for the FOR UPDATE clause in the cursor declaration. In order for this setup to work, you will need to change all of the cursor declarations for any cursor that is used for updating.
Here’s a sample of what your SQL settings might look like:
Here is a sample SQL cursor declaration for an updatable cursor: