Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 2: CICS Architecture


CICS Transaction Manager

The transaction manager is the Task Control Program, DFHKCP. It creates one task for every execution of a transaction and manages all the tasks running in the region.

What is the transaction manager

  • The transaction manager is the Task Control Program, DFHKCP. It is part of the CICS nucleus.
  • A transaction is work defined in the PCT by a TRANSID, for example ORD1.
  • A task is one execution of a transaction. The same transaction can run as many tasks at once - one per user.
  • Task Control attaches a task when work arrives and detaches it when the work finishes.

How tasks are started

  • Terminal input: the user types a TRANSID or presses a PF key. Terminal Control passes it to Task Control, which attaches the task.
  • ATI (Automatic Transaction Initiation): an intrapartition transient data queue reaches its trigger level and CICS starts the named transaction by itself.
  • EXEC CICS START: one program starts another transaction, either at once or at a future time.
  • Each task gets a task number (EIBTASKN) that is unique inside the region while the task runs.

Multitasking, multithreading and quasi-reentrancy

  • Multitasking: CICS runs many tasks at the same time. Under the covers it is one MVS task switching rapidly between CICS tasks.
  • Multithreading: one copy of a program in storage can be used by many tasks at once, each with its own working storage.
  • Quasi-reentrant: a CICS program must be re-enterable between CICS commands. Between two EXEC CICS commands, another task may run the same program code.
  • Because of this, never keep task data in storage shared by all tasks. Keep it in the COMMAREA, the TWA, or GETMAIN storage.

Task lifecycle

  • Attach: Task Control creates the task control block and assigns a task number.
  • Dispatch: the CICS dispatcher gives the task CPU time to run.
  • Suspend: the task waits - for example for a file read or terminal input. Other tasks run meanwhile.
  • Resume: the wait is over and the task continues where it left off.
  • Terminate: the program issues EXEC CICS RETURN or abends. Task storage is freed automatically.

Example - reading task information in COBOL

  • EIBTRNID holds the transaction id and EIBTASKN holds the task number. Both come free with every task.
  • WORKING-STORAGE SECTION. 01 WS-TRAN-ID PIC X(4). 01 WS-TASK-NUM PIC 9(7). PROCEDURE DIVISION. MOVE EIBTRNID TO WS-TRAN-ID MOVE EIBTASKN TO WS-TASK-NUM EXEC CICS SEND TEXT FROM('TRANSACTION STARTED') END-EXEC EXEC CICS RETURN END-EXEC.
  • Logging the TRANSID and task number helps you match program messages to CICS dumps and traces later.





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant