The DB001061 error from a server-based task is a fairly generic error. When this error is accompanied by max task condition, a likely cause is discussed in this document.
Web or other server-based applications can receive a these messages:
JDBC error reported: (SQLState = 24000) - java.sql.SQLException:
DB001016 Tnnnn C-4Mnnn: Invalid cursor state
It is possible that this DB001016 message will not show up in the JES messages or in OLP; it can also be sporadic. When this coincides with a system Max Task condition, this problem is likely due to the high number of external transactions required to complete server-based tasks.
In the sysgen, several parms are related. MAX TASKS indicates the number of online tasks that are permitted to simultaneously run. Similarly, MAX ERUs indicates instead the maximum number of concurrent non-DDS External transactions that can simultaneously run. For each task that is executed, a DCE/TCE pair is both allocated and required. The system will limit the number of TCE/DCE pairs to (MAX ERUs + MAX TASKS). Transactions associated with server-based tasks will be tracked internally as ERUs (External Request Units). The sysgen MAX ERUS specification also determines the number of ERE control blocks (External Request Elements). This limits the number of ERUS tasks that can be concurrently active. If a CV is at MAX ERUS a new external request gets 1473 error-status. A high number of ERUs required for a server-based task can cause us to hit both MAX ERUS and/or MAX TASKS depending on the settings (System MAX TASKS threshold can be dynamically altered with DCMT commands to be lower than the sysgen calculated number).
To resolve this, you could increase either or both parms (MAX TASKS or MAX ERUS) depending on the conditions encountered. As a general rule, it is wise to define the sysgen for any CV which supports ODBC or JDBC activity so that it does not hit MAX TASKS or MAX ERUS condition. Doing so will cause server-based tasks to abend, if a required resource is unavailable the moment it is needed.