Module 10: CICS Transaction Processing
Task Control
A task is one execution of a transaction. Task control is the part of CICS that creates, schedules, and ends tasks.
Many tasks run at the same time in one CICS region, and task control keeps them from interfering with each other.
Task, transaction, and program
- A transaction is the definition identified by a trans-id; a task is one live execution of it.
- One transaction definition can have many tasks running at once, one per user.
- The program is the code the task executes; the task is the unit of work doing the executing.
- Each task gets its own EIB, its own transaction work area (TWA), and its own working storage.
How task control works
- When input arrives, terminal control notifies task control, which attaches a new task.
- Task control gives the task a number, visible in the EIBTASKN field, and dispatches it when resources are free.
- The task runs until it waits for input or I/O, or until it ends; then another waiting task is dispatched.
- This multitasking is how one CICS region serves hundreds of users at the same time.
Task control commands and data
- SUSPEND pauses the current task voluntarily until an event wakes it up again.
- ENQ and DEQ let tasks serialize access to shared resources.
- The EIB fields EIBTRNID and EIBTASKN identify the transaction and the task number.
- Transaction classes (TRANCLASS) limit how many tasks of a transaction may run concurrently.
Example of SUSPEND
- SUSPEND yields the task so other tasks can run while this one waits for an event.
- *--- pause this task until the event completes --- EXEC CICS SUSPEND END-EXEC.
- Use SUSPEND only when another task or an interval control event will wake this task up.
