Progress0 of 0 lessons

CICS CANCEL (INTERVAL) - Interval Timer Cancellation

CICS CANCEL (INTERVAL) cancels a previously scheduled interval timer. It enables programs to stop interval timers, manage timer operations, and handle interval timer cancellation in CICS applications.

What is CICS CANCEL (INTERVAL)?

CICS CANCEL (INTERVAL) is a command that allows programs to cancel a previously scheduled interval timer. It provides timer cancellation capabilities, interval management, and timer cleanup for CICS applications.

Command Syntax

cobol
1
2
3
4
EXEC CICS CANCEL INTERVAL(interval-name) [RESP(response-code)] END-EXEC

Parameters

Required Parameters

  • INTERVAL(interval-name) - Name of the interval timer to cancel

Optional Parameters

  • RESP(response-code) - Response code variable

Programming Examples

Basic Interval Cancellation

cobol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
WORKING-STORAGE SECTION. 01 INTERVAL-NAME PIC X(8) VALUE 'MYTIMER'. 01 RESPONSE-CODE PIC S9(8) COMP. PROCEDURE DIVISION. *> Start an interval timer first EXEC CICS START INTERVAL(INTERVAL-NAME) TIME(60) RESP(RESPONSE-CODE) END-EXEC. IF RESPONSE-CODE = DFHRESP(NORMAL) DISPLAY 'Interval timer started successfully' *> Later, cancel the interval timer EXEC CICS CANCEL INTERVAL(INTERVAL-NAME) RESP(RESPONSE-CODE) END-EXEC. IF RESPONSE-CODE = DFHRESP(NORMAL) DISPLAY 'Interval timer cancelled successfully' ELSE DISPLAY 'Error cancelling interval: ' RESPONSE-CODE END-IF ELSE DISPLAY 'Error starting interval: ' RESPONSE-CODE END-IF.

Error Handling

Common Response Codes

  • DFHRESP(NORMAL) - Interval timer cancelled successfully
  • DFHRESP(INVREQ) - Invalid request or interval name
  • DFHRESP(NOTFND) - Interval timer not found
  • DFHRESP(NOTAUTH) - Not authorized to cancel interval

Performance Considerations

Efficiency

  • Lightweight Operation - CANCEL (INTERVAL) is a lightweight command with minimal performance impact
  • Resource Cleanup - Always cancel unused interval timers to free system resources
  • Impact Consideration - Consider the impact of cancelling timers on dependent processes

Best Practices

  • Error Handling - Always check the response code for error handling
  • Resource Management - Cancel interval timers when they are no longer needed
  • Naming Convention - Use meaningful interval names for easier management

Explain It Like I'm 5 Years Old

Think of CICS CANCEL (INTERVAL) like turning off an alarm clock:

  • Set Alarm: "Set the alarm for 7 AM" - Start interval timer
  • Change Mind: "Actually, I don't want to wake up at 7 AM" - Cancel interval
  • Turn Off Alarm: "Turn off the alarm clock" - CANCEL (INTERVAL)
  • Alarm Off: "Now the alarm won't go off" - Timer cancelled

Exercises

Exercise 1: Basic Interval Cancellation

Create a program that starts an interval timer and then cancels it after a short delay.

Exercise 2: Timer Management

Write a routine that manages multiple interval timers and cancels them when no longer needed.

Exercise 3: Error Handling

Implement error handling for the CANCEL (INTERVAL) command.