12 Multiple Task Programming

Example Program Using TASK

If you have read and understood the previous chapters, programming with TASK is simple and straight-forward. The following is an example of a simple task that generates a report in a secondary task (assuming that the Gen_report routine does the actual report generation).

10  DIM File_name$[6]
20  INPUT "Please enter first file name ";File_name$
30  WHILE File_name$ <> "STOPIT"
40  CALL Gen_report(File_name$)
50  INPUT "Please enter next file name ";File_name$
60  END WHILE
70  END
This program can be initiated by explicitly requesting a secondary task using the REQUEST and ATTACH commands, entering the program, and executing RUN. The operator can then press CTRL D to return to the primary task.

The primary task can interact with the secondary task (taskid #2 in this example) in the following manner:

   ATTACH #2
Once the secondary task is obtained, the file name prompt will be displayed:

   Please enter first file name
Now enter the file name desired. Once the file name is entered, the secondary task will be underway. Now enter the DETACH statement. This will cause the terminal to switch back to the primary task. A return from subroutine Gen_report will cause the secondary task to wait for another file name to be input. The operator of the terminal can now repeat the process to resume the secondary task. Note that this program does not provide a way to inform the primary task when one file is processed.


Eloquence Language Manual - 19 DEC 2002