Spooling functions are performed by the system without requiring any special operations by the program that creates the output. When a program opens a printer file, the operating system determines if the output is to be spooled by looking at the printer file SPOOL parameter.
When a printer file specifying spooling is opened, the spooled file containing the output of the program (data to be printed) is placed on the appropriate output queue in the system. A spooled file can be made available for printing when the printer file is opened, when the printer file is closed, or at the end of the job. This is done by specifying a particular value on the schedule parameter. *IMMED makes the spooled file available to the writer as soon as the program is opened. *FILEEND makes the spooled file available to the writer as soon as the file is closed. *JOBEND makes the spooled file available to the writer as soon as the job is complete.
This process of spooling prevents a potential job limitation imposed by the availability or speed of the printer devices. That is, the system can process application programs that generate printed output much faster than printers can print the output.
By spooling (that is, sending the output to output queues to await printing), the system does not have to wait until the printing for that application program is complete before it can start processing the next application program.
Spooling is especially important in a multiple-user environment where the number of jobs running often exceeds the number of available printer devices. Using spooling, output can be easily redirected from one output queue to another or from one printer to another.