Saturday, November 17, 2012

CICS: What is the difference between transaction and task ?



   A transaction is a piece of processing initiated by a single request,
   usually from an end user at a terminal.  A single transaction will consist
   of one or more application programs that, when run, will carry out the
   processing needed.

   In other words, "transaction" means in CICS what it does in everyday
   English:  a single event or item of business between two parties.  In
   batch processing, transactions of one type are grouped together and
   processed in a batch (all the updates to the personnel file in one job, a
   list of all the overdue accounts in another, and so on).  In an online
   system, by contrast, transactions aren't sorted by type, but instead are
   done individually as they arrive (an update to a personnel record here, a
   customer order entered there, a billing inquiry next, and so on).

   Having given you this straightforward definition, we'll immediately
   complicate things a bit by admitting that the word "transaction" is used
   to mean both a single event (as we just described) and a class of similar
   events.  Thus, we speak of adding Mary Smith to the Payroll File with a
   (single) "add" transaction, but we also speak of the "add" transaction,
   meaning all additions to that particular file.

   Things are further complicated by the fact that one sometimes describes
   what the user sees as a single transaction (the addition to a file,
   perhaps) as several transactions to CICS. 
   Now, what about a task?

   Users tell CICS what type of transaction they want to do next by using a
   transaction identifier.  By convention, this is the first "word" in the
   input for a new transaction, and is from one to four characters long,
   although this source of the identifier is sometimes overridden by
   programming.

   CICS looks up the transaction identifier to find out which program to
   invoke first to do the work requested.  It creates a task to do the work,
   and transfers control to the indicated program.  So a task is a single
   execution of some type of transaction, and means the same thing as
   "transaction" when that word is used in its single event sense.

   A task can read from and write to the terminal that started it, read and
   write files, start other tasks, and do many other things.  All these
   services are controlled by and requested through CICS commands in your
   application programs.  CICS manages many tasks concurrently.  Only one
   task can actually be executing at any one instant.  However, when the task
   requests a service which involves a wait, such as file input/output, CICS
   uses the wait time of the first task to execute a second; so, to the
   users, it looks as if many tasks are being executed at the same time.




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.