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

Module 3: CICS Transactions and Commands


Task vs Transaction

Beginners often mix up task and transaction. They are related, but they are not the same thing.

What is a transaction

  • A transaction is the logical unit of work — what the user wants done, like “add a customer”.
  • It is identified by its 1-to-4 character transaction id.
  • From the user’s point of view the transaction is one continuous job, even across many screens.
  • In a pseudo-conversational design one transaction lives across several separate tasks.

What is a task

  • A task is one execution of a program under CICS — the runtime instance doing the work.
  • CICS creates a task every time a transaction (or part of it) starts running.
  • Each task gets its own working storage, its own EIB, and its own task control area (TCA).
  • Many tasks for the same transaction id can run at the same time — one per user.
  • A task ends when the program issues RETURN; the transaction may or may not end with it.

Key differences

  • Meaning: transaction = what the user wants done; task = one run of the program that does part of it.
  • Count: one transaction can need many tasks (pseudo-conversational); one task always belongs to one transaction.
  • Lifetime: a task ends at every RETURN; the transaction ends only at the final RETURN without TRANSID.
  • Scheduling: CICS schedules and dispatches tasks, not transactions.
  • Isolation: tasks are isolated from each other — one task’s abend does not kill other tasks.
  • A task can find out which transaction started it:-
    *--- A task can find out which transaction started it ---* WORKING-STORAGE SECTION. 01 WS-TRAN-ID PIC X(4). PROCEDURE DIVISION. EXEC CICS ASSIGN TRANID(WS-TRAN-ID) END-EXEC. * WS-TRAN-ID now holds the transaction id, for example 'MNT1'





© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant