This variable allows you to divert printer output to a file or port through the Windows print spooler. Files created in this way are stored in binary encoding. You may set the Windows print spooler with -P SPOOLER or -Q <printername> with or without the DIRECT option. However, if you omit the DIRECT option, the resulting file will include all the embedded control codes formatting the print job for the original target printer.

By default, the value of WIN_SPOOLER_PORT is undefined. Set WIN_SPOOLER_PORT to a valid filename or port. This can be done in a configuration file, in the environment, or in the program. For example:

WIN_SPOOLER_PORT  c:\mydir\myprint.prn
SET ENVIRONMENT "WIN_SPOOLER_PORT" TO "c:\mydir\myprint.prn".

This will affect all print jobs performed in the current instance of the runtime. Any graphics operations performed in the COBOL application, such as WINPRINT-BITMAP or WINPRINT-GRAPH-DRAW, are preserved in the file, and will print. However, these options may result in a very large binary file.

The resulting file can be copied directly to any printer that is compatible with the original target printer. For example, the following command:

COPY /B c:\mydir\myprint.prn LPT1

will send the file to LPT1, while the /B option tells the COPY command that the file contains binary encoding.