


There are two ways to use the Windows spooler to format your print file: "-P SPOOLER" and "-Q <printername>". (If you wish to control formatting yourself, refer to section 1.2.5.2 "Direct Control" below.)
-P SPOOLER
If you want to use the default printer and font, simply assign your print file
to
"-P SPOOLER". For example, to assign "PRINTER1" to the spooler, enter the
following line in your COBOL configuration file ("CBLCONFI"):
PRINTER1 -P SPOOLER
By default, the runtime system assigns the "PRINTER" device to the spooler. You may change this in the configuration file by assigning "PRINTER" to some other name.
When the runtime opens a file assigned to "-P SPOOLER", it automatically initiates a job with the Windows spooler and constructs print pages in accordance with your program. The runtime uses the default printer and font. If the user looks for the job in the spooler, it is named with the current title of the ACUCOBOL-GT window.
-Q <printername>
If you want the Windows spooler to format the pages of your report, but you want to use a particular printer, assign your print file to:
PRINTER1 -Q \\printername
in the configuration file ("CBLCONFI"). Printername may be up to 80 characters long and contain embedded spaces. The name may not include the semicolon character (;) or be surrounded by single or double quotes. The pages are printed in the manner described in "-P SPOOLER" above. The sample programs "graphprn.cbl" and "prndemox.cbl" contain examples of these functions.
To determine a valid printername, use the WIN$PRINTER library routine to obtain the name of the desired printer. (This is described in Appendix I under the WINPRINT-SET-PRINTER operation code in "Specifying a Printer.") Then add the following line to your code:
MOVE "-Q \\printername" TO WS-PRINTER-NAME.
When the runtime opens a file assigned to "-Q <printername>" it will set the Windows print spooler to use this printer. The printer driver must be installed on the computer from which you print. If printername is not recognized by the runtime, a dialog box allows you to choose a printer manually.
You may also use "-Q <printername>" to set several other printing options in the configuration file using the following syntax:
<-Q printername>[;option1=x][;option2=x][;option3=x]...
The following options may appear in any order. Options not supported by the printer driver are ignored. Printername should appear as shown in WINPRINT-NAME, but the options are case insensitive.
FONT - Use FONT to specify a single font name. The font name may have embedded spaces, but may not contain double or single quotes. If the font does not exist, the closest matching font will be chosen.
COLS - Specifies the number of columns (width) on the page. This number is not validated by the runtime or the spooler. Choose a number of columns that coordinate with the selected font and pitch when designing the report layout.
LINES - Specifies the lines (rows of characters) on the page. This number is not validated by the runtime or the spooler. Choose a number of lines that is compatible with the selected font and pitch when designing the report layout.
ORIENTATION - If your printer supports this feature, ORIENTATION allows you to specify LANDSCAPE or PORTRAIT orientation for the report.
Examples
To use the Windows spooler with an HP Laserjet printer driver located on SERVER1, and specify the font, font size, width and number of lines in the report, enter the following into CBLCONFI:
PRINTER1 -Q \\SERVER1\HP Laserjet IV;FONT=Times New Roman;PITCH=12;COLS=132;LINES=65.
To print three copies directly to the printer on a server named GUTENBERG in Landscape orientation, enter the following into CBLCONFI:
PRINTER1 -Q \\GUTENBERG\HP Laserjet IV;DIRECT=ON;ORIENTATION=LANDSCAPE;COPY=3