A task is created for each executed transaction identifier, TRANSID, recognized by CICS (found in the Program control Table). A task can include one or several programs. A task continues until a program returns control to CICS or issues a RETURN command in a pseudo-conversational program. Only one task can be executing at a given time, but the user may perceive that many tasks are running.
Multitasking means that the operating system (OS) allows more than one task to be executed concurrently, regardless of whether the tasks use the same program or different programs. Therefore, this is not a unique concept to CICS. But CICS manages multitasking of CICS tasks within its own region. That is, CICS provides a multitasking environment where more than one CICS task runs concurrently.
Multithreading is the system environment where the tasks are sharing the same program under the multitasking environment. Multithreading is a subset of multitasking, since it concerns tasks which use the same program.
Under the multithreading environment, a program is shared by several tasks concurrently. For each task, the program (i.e., instructions and data area) must work as if it were executing instructions exclusively for each task. Therefore, it requires special considerations such as reentrancy or serial reusability.
Contrary to the multithreading environment, under the single threading environment, a program is used by only one job (or task) at a time. A typical example is a batch job.
Operating system allows execution of more than one task concurrently and this is called multitasking. If the one or more concurrent tasks use the same copy of the program, then this is called multithreading. So it is obvious that multitasking is a subset of multithreading.
Conversational programming is a coding technique that results in a program being loaded into and remains in main storage until user finishes working with the program. The program is not released from main storage when not active, as in pseudo conversational programming. For instance, a conversational program displays a map and remains in main storage while waiting for a user’s response.
Practical applications of conversational programming are very limited.
CICS allows many users to log on and use CICS concurrently. Computer main-storage size is finite. If numerous users are running transactions demanding considerable main storage, a short-on-storage condition could occur, causing delays.
Pseudo-conversational programming is a coding technique that results in a program being loaded into main storage when required and released when it is no longer active. For instance, when a map is displayed and the program is waiting for a user’s response, the program can be released from main storage and reloaded when needed.
CICS loads and releases application programs from main storage automatically. High-use programs are often defined as main-storage-resident, and the system keeps them in main storage. Tables and maps, which are considered programs by CICS, are usually controlled by a program.
Generally, when using the Pseudo-conversational technique of processing, pressing an AID key causes a program to be loaded if it is not already in main storage. When a program is finished with a logical segment of processing, it normally sends a map, saves required data, and returns control to CICS.
If the same copy of the program is used by multiple tasks, then the system should take care of the proper reentrance after the SVC/CICS interruption.
Reentrant program is defined as a program that does not modify itself so that it can reenter to itself and continue processing after an interruption by the SVC call of OS. Batch programs are non-reentrant. Reentrancy under CICS environment is called quasi entrant as the interruption in CICS may involve more than one SVC calls or no SVC at all.
COBOL programs should be compiled with RENT option for reentrancy in multithreading environment.
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!