12 Multiple Task Programming
10 DIM File_name$ 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 ENDThis 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 #2Once the secondary task is obtained, the file name prompt will be displayed:
Please enter first file nameNow 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.