12 Multiple Task Programming
A secondary task, like a primary task, is a process or session; however, a secondary task is started from a primary task using the REQUEST # and ATTACH # statements (discussed later in this chapter). In other words, a secondary task is owned by a primary task. There can be more than one secondary task per primary task. The maximum number of secondary tasks allowed depends upon what has been defined by the system administrator in the global configuration file. One primary task can have a maximum of nine secondary tasks. Each secondary task is assigned a TASKID (or USRID), just as with primary tasks. Each secondary task is referenced by its unique TASKID.
Different types of programs can run in secondary tasks; however, any job that runs in a secondary task must require very little interaction with a user. Typical examples are updating databases from transaction files, generating large records, and generating reports.
A primary task can attach to any secondary task, as long as the secondary task is not currently owned by another primary task. Ownership allows "terminal attachment" by the primary task and, at the same time, inhibits access to the secondary task by other users.