How to determine the source and number of open SQL cursors in Datacom. We want to identify programs that have not closed cursors.
The SQL_STATUS_FRONT dynamic system table allows viewing the source of executing SQL statements and open cursors waiting for further fetches.
You MUST disable the SQL SOURCE CACHE when attempting to generate and retrieve this data. Please note that this will slightly increase MUF CPU usage.
Steps to retrieve the list of query source(s) and open cursor(s) in the MUF environment:
SQL_SOURCE_CACHE_STMTS " and set it 0 and recycle the MUFINSERT INTO sysadm.sql_console values (CURRENT DATACOM MUF_NAME,'SQL_SOURCE_CACHE_STMTS 0');SELECT JOB_NAME, COUNT(*), TRIM(SUBSTR(SOURCE_FRONT, 53, 3847)) AS SOURCEFROM SYSADM.SQL_STATUS_FRONTGROUP BY JOB_NAME, TRIM(SUBSTR(SOURCE_FRONT, 53, 3847))ORDER BY 1, 2 DESC;JOB_NAME COUNT(*) SOURCE---------------------------------------------------Job1 2 SELECT ID, DESCC FROM TBL233 FETCH FIRST 1 ROWS ONLYJob2 2 SELECT ID, DESCC FROM TBL233 FETCH FIRST 1 ROWS ONLY
Job3 1 SELECT ID, DESCC FROM TBL233 FETCH FIRST 1 ROWS ONLY
SQL_SOURCE_CACHE_STMTS " and set it to 1000, then recycle the MUFINSERT INTO sysadm.sql_console values (CURRENT DATACOM MUF_NAME,'SQL_SOURCE_CACHE_STMTS 1000');Review the result data to identify queries with open cursors and updating the application to gracefully close the cursor, statement, or connection as required.
See Datacom documentation section SQL_STATUS_FRONT (SQF) and SQL_SOURCE_CACHE_STMTS.