CICS programs, transactions and tasks
To develop and run CICS® applications, you need to understand the relationship between CICS programs, transactions, and tasks.
- A program is used by CICS to process an entire transaction, or part of a transaction. Programs are stored in the program library. For more information about program resources and programs used in CICS bundles, see PROGRAM resources.
A transaction is an item of processing that is initiated by a single request. This request is usually from an end-user at a terminal, but can also be made from a web page, a remote workstation program, or an application in another CICS system, or triggered automatically at a predefined time. For descriptions of different ways to run CICS transactions, see Internet, TCP/IP, and HTTP concepts and Overview of CICS external interfaces.
A single transaction consists of one or more application programs that, when run, carry out the processing needed.
However, the term transaction is used in CICS to mean both a single event and all other transactions of the same type. You describe each transaction type to CICS with a TRANSACTION resource definition. This definition gives the transaction type a name (the transaction identifier, or TRANSID) and provides information to CICS about the work to be done; for example, which program to invoke first, and what kind of authentication is required throughout the execution of the transaction.
You run a transaction by submitting its TRANSID to CICS. CICS uses the information recorded in the TRANSACTION definition to establish the correct execution environment, and starts the first program.
The term transaction is now used extensively in the IT industry to describe a unit of recovery, which in CICS is called a unit of work. This is typically a complete operation that is recoverable; it can be committed or backed out as an entirety, as a result of programmed command or system failure. In many cases, the scope of a CICS transaction is also a single unit of work, but be aware of the difference in meaning when you use non-CICS documentation.
- The term task has a specific meaning in CICS and CICS documentation. When CICS receives a request to run a transaction, it starts a new task that is associated with this one instance of the execution of the transaction type; that is, one execution of a transaction, with a specific set of data, usually on behalf of a specific user at a specific terminal. You can also consider a task as analogous to a thread. When the transaction completes, the task ends.