Unanswered: Question about recovering from CAF errors on OPEN
So, our application uses CAF to communicate with DB2 and we use the DSNALI module.
We use the DSNALI function 'OPEN' to connect to DB2, using the specified subsystem and plan. If the OPEN fails (like an invalid plan was specified), the TCB created contains information from the failed OPEN and that is causing other problems.
For example, if the OPEN fails while connecting to subsystem 'A' (which is valid) using plan 'BOGUS' (which is invalid), a return code of '8' is returned by CAF with a reason code of '00F30034'. Cool.
If we then try to open a NEW connection to DB2 using subsystem 'B' (which is valid but on another system) using plan 'GOOD' (which is a valid plan), a return code of '200' is returned with a reason code of '00C10208'.
In an attempt to "gracefully" recover from the initial failed OPEN, we have tried to use the 'CLOSE' and 'DISCONNECT' functions but those fail as well. When we use the 'CLOSE' function, a return code of '200' is returned with a reason code of '00C10203'. When we use the 'DISCONNECT' function, a return code of '200' is returned with a reason code of '00C10204'.
I have found the explanations of the various reason codes we're getting:
Ok, this issue has been resolved. The problem was with the use of the 'OPEN' function to do an explicit connection to the specified subsystem and plan.
If the 'OPEN' function is used and the implicit connection to the specified subsystem and plan works BUT the 'OPEN' can't allocate the resources for the specified plan, the TCB being used CAN NOT be used to connect to a different subsystem. Why not? Because the implicit connection is still open.
If an explicit 'CONNECT' is used before the 'OPEN', an explicit 'DISCONNECT' can be used in the event the 'OPEN' fails.
I had to open an ETR with IBM to get this information.