Previous Topic: Initiating Nonterminal TasksNext Topic: Time-Delayed Tasks


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:

  1. Issue an ATTACH statement that specifies the task code of the task to be initiated.
  2. 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.
  3. Perform alternative processing if 3711 is returned.
  4. 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 ***