After cancelling a query run from CICS now getting SQL RC -125 and error:
DQ093E - PLAN CURRENTLY IN USE BY LOGICAL UNIT OF WORK ID X'nnnnnnnnnnnnnnnn'
How can this plan lock be cleared?
To resolve the problem try the following in sequence:
Do a COMM STATUS and see if there's still a MUF task active for the cancelled task. If there is, do a REQABORT command on it.
Do a SELECT * FROM SYSADM.SQL_STATUS_CURRENT;
If the cancelled CICS task is still there, the SQL task can be cancelled by doing a DELETE of the row:
DELETE FROM SYSADM.SQL_STATUS_CURRENT WHERE PLAN_AUTH = authid AND PLAN_NAME = plan_name;
Do a SELECT * FROM SYSADM.SQL_STATUS_PLAN;
If the plan is still there, it can be freed by doing a DELETE on the row.
DELETE FROM SYSADM.SQL_STATUS_PLAN WHERE PLAN_AUTHID = authid AND PLAN_NAME = plan_name;
If there was nothing in the previous 3 steps, use this query to free the plan by inserting a row into the STATUS_PLAN table. Only change the authid and plan_name, the rest of the query can remain as is.
INSERT INTO SYSADM.SQL_STATUS_PLAN VALUES ('MUF', '2019-02-19-12.01.01.000000', 'authid', 'plan_name', '2019-02-19', '12:01:01', '2019-02-19', '12:01:01', 0,0,0,0,7,'R','C',' ', ' ');
Note: If uncertain about what to delete or cancel open a support case to be guided by one of our engineers.