CANCEL
CANCEL
The CICS CANCEL statement cancel interval control requests. This statement can cancel a previously issued DELAY, POST, or START command. The effect of the cancellation varies depending on the type of command being canceled:
- A DELAY command can only be canceled before it expires. The REQID of the suspended task must be provided.
- If a POST command is issued by the same task and needs to be canceled, there is no need to specify a REQID. However, if the POST command was issued by a different task, you must specify the REQID associated with that command in order to cancel it.
- To cancel a START command, you need to provide the REQID linked to the original command.
Syntax -
EXEC CICS CANCEL
[REQID(name)]
[SYSID(system-name)]
[TRANSID(name)]
[RESP(response-field)]
[RESP2(response-field2)]
END-EXEC.
- REQID(name) - Specifies a unique name (1–8 characters) to identify a previous command.
- SYSID(system-name) - Specifies the system name to which the request is directed.
- TRANSID(name) - Specifies the transaction used to determine where the CANCEL command is to be executed.
- RESP(response-variable) - Optional. It captures the response code of the CANCEL operation and used to check if the command executed successfully or encountered an error.
- RESP2(response2-variable) - Optional. It captures the response2 code of the CANCEL operation when the error occured.
Short Examples -
Scenario - Cancelling a transaction when the error occured.
...
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-TRANS-ID PIC X(4) VALUE 'TRN1'.
01 WS-RESP PIC S9(4) COMP.
PROCEDURE DIVISION.
EXEC CICS START
TRANSID(WS-TRANS-ID)
SYSID(WS-SYS-ID)
AT(WS-TIME)
REQID(WS-REQ-ID)
RESP(WS-RESP)
END-EXEC.
IF WS-RESP = DFHRESP(NORMAL) THEN
...
ELSE
EXEC CICS CANCEL
TRANSID(WS-TRANS-ID)
REQID(WS-REQ-ID)
RESP(WS-RESP)
END-EXEC
END-IF.
...
The transaction ID TRN1 is specified. START initiates the transaction asynchronously. If the command execution is unsuccessful, cancel the transaction execution.
Error Conditions -
Eror Condition | RESP | RESP2 | Reason |
---|---|---|---|
NOTFND | 13 | Occurs if the request identifier specified fails to match an unexpired interval control command. | |
SYSIDERR | 53 | 130 | The SYSID name specified is neither the local region nor a remote system or the link to the remote system is closed. |
ISCINVREQ | 54 | The remote system indicates a failure that does not correspond to a known condition. | |
NOTAUTH | 70 | Occurs when a resource security check has failed on the specified TRANSID. |