MainframeMaster

CICS Timer Management

Timers let you schedule deferred or periodic work. Combine timers with events and BTS to orchestrate background processing reliably.

Timer Types

  • INTERVAL: Runs after a specified number of seconds; can be used for recurring patterns by rescheduling.
  • ABSOLUTE: Schedule work for a specific absolute time (use FORMATTIME to compute values; implementation varies by site standards).
  • EVENT-DRIVEN: Combine timers with SIGNAL EVENT to fan-out processing.

Scheduling Work

cobol
1
2
3
4
5
6
* Start an interval timer EXEC CICS START INTERVAL('ORDTMR') TIME(300) * seconds TRANSID('ORD1') RESP(WS-RESP) END-EXEC.

Inquiry and Control

cobol
1
2
3
EXEC CICS INQUIRE TIMER('ORDTMR') RESP(WS-RESP) END-EXEC. EXEC CICS CHECK TIMER('ORDTMR') RESP(WS-RESP) END-EXEC. EXEC CICS FORCE TIMER('ORDTMR') RESP(WS-RESP) END-EXEC.

Patterns

Recurring Task

cobol
1
2
3
4
5
6
7
8
* Inside ORD1 transaction PERFORM DO-WORK * Reschedule self for next run EXEC CICS START INTERVAL('ORDTMR') TIME(300) TRANSID('ORD1') RESP(WS-RESP) END-EXEC.

Deferred Processing via Event

cobol
1
2
3
4
5
* Timer fires and signals an event picked up by a worker EXEC CICS SIGNAL EVENT('REPRICE-JOB') CHANNEL('RPCH') RESP(WS-RESP) END-EXEC.

Error Handling

Check RESP/RESP2 after each operation. Handle INVREQ, NOTFND, and LENGERR appropriately.

Common RESP Values

RESPMeaningTypical Action
NORMALOperation succeededContinue
NOTFNDTimer not foundCreate or skip
INVREQInvalid parameter/stateValidate inputs