Initiating Nonterminal Tasks
Not all tasks in a DC system are associated with a logical terminal; a task not associated with a logical terminal is called a nonterminal task. For example, you can initiate processing of another task while your task is still running; this is called attaching a task. The new task competes for processor time and runs concurrently with all other tasks, but is not associated with any terminal. You can indicate either that the nonterminal task should begin processing immediately or after a specified length of time.
idmscu19
Not all tasks in a DC system are associated with a logical terminal; a task not associated with a logical terminal is called a
nonterminal
task. For example, you can initiate processing of another task while your task is still running; this is called attaching
a task. The new task competes for processor time and runs concurrently with all other tasks, but is not associated with any terminal. You can indicate either that the nonterminal task should begin processing immediately or after a specified length of time.Because nonterminal tasks are not associated with an LTE, they cannot perform processing related to a logical terminal. For example, nonterminal tasks cannot perform terminal I/O, receive messages, or monitor resource usage.
This article describes the following information:
Attaching a Task
Attached tasks typically perform support functions for the initiating task. For example, an attached task might perform print functions that can be requested by the user.
Steps to Attach a Task
To initiate a nonterminal task to be performed immediately:
- Issue an ATTACH statement that specifies the task code of the task to be initiated.
- If the NOWAIT parameter is specified, check for a status of 3711 (DC-MAX-TASKS), which indicates that the task was not initiated because a maximum task condition exists.
- Perform alternative processing if 3711 is returned.
- Perform the IDMS-STATUS routine if 3711 is not returned.
Example of Attaching a Task
The program excerpt below initiates the nonterminal task DEPTPRNT if the user presses PA02.
PROGRAM-ID. GETMENU. DATA DIVISION. WORKING-STORAGE SECTION. 01 DEPTPRNT PIC X(8) VALUE 'DEPTPRNT'. PROCEDURE DIVISION. BIND MAP SOLICIT. BIND MAP SOLICIT RECORD SOLICIT-REC. MAP IN USING SOLICIT. INQUIRE MAP SOLICIT MOVE AID TO DC-AID-IND-V. *** ATTACH TASK IF OPERATOR PRESSES PA02 *** IF PA02-HIT ATTACH TASK CODE DEPTPRNT PRIORITY 100 NOWAIT ON DC-MAX-TASKS GO TO MAP-OUT-ERR-MT. . *** INPUT PROCESSING ***
Time-Delayed Tasks
You may want to initiate a nonterminal task, but your processing needs require that it not be concurrent with the issuing task. For example, the time-delayed task may compete for resources with the issuing task. DC allows you to initiate a task at the end of a specified period of time.
Steps to Initiate a Time-Delayed Task
To initiate a time-delayed task, perform the following steps:
- Initiate all appropriate fields.
- Issue a SET TIMER statement that specifies the START parameter, the time interval (in seconds), the time-delayed task's task code, the timer ID, and the variable-storage location of any data to be passed to the time-delayed task.
External Requests
DC starts an external request task in response to a request issued by a batch program running outside of the DC region of the operating system. The batch program's operating mode (PROTOCOL) must specify DC-BATCH.
For more information about DC-BATCH, see “Batch Access to DC Queues and Printers.”
Queue Threshold Tasks
A sysgen-defined queue ca CAuse a nonterminal task to be started automatically if a predefined threshold is reached. When the queue threshold is reached, DC initiates the nonterminal task. Such a nonterminal task reports on the queue records and then deletes them.
For example, a queue may have a threshold of 100. When the queue exceeds 100 records, DC initiates a task that prints a report and deletes the queue records.
Queue threshold tasks must completely drain the queue and delete all the queue records.