If you want to control the format of the printout yourself using embedded control codes, simply assign your print file to -P SPOOLER-DIRECT or to -Q <printername> using the DIRECT=ON option. For example, to assign the print job "PRINTER1" to the spooler and retain direct control over formatting, enter the following line in your COBOL configuration file (CBLCONFI):
PRINTER1 -P SPOOLER-DIRECT
Or, use the following command to assign PRINTER1 to the spooler for printing to a specific printer while retaining direct formatting control:
PRINTER1 -Q printername;DIRECT=ON
Both of these methods cause the print job to be sent to the printer via the Windows spooler, but the program does not use the spooler to format the pages. You must use embedded control codes to handle formatting (much as you would under UNIX if you used the UNIX spooler).
When using the -P SPOOLER-DIRECT option, you may use the WIN$PRINTER library routine to choose a printer, but because you completely control the printer, the various options provided by WIN$PRINTER are ignored. For example, WIN$PRINTER does not set the page size, page orientation, or font. Information returned from WIN$PRINTER, such as number of lines and columns on the page, may not be accurate and should not be used. This subject is discussed in detail in Appendix I "Library Routines" of the ACUCOBOL-GT manual set.
Because some print drivers do not flush the last page, be sure to end your last page with a form-feed (for example, WRITE ... BEFORE ADVANCING PAGE). This ensures that all pages are printed. The ACUCOBOL-GT runtime ensures that no extra blank pages are printed at the end.
If you code WRITE...AFTER ADVANCING PAGE instead of WRITE...BEFORE ADVANCING PAGE, you might receive a blank last page. This is because a blank line written on the new page causes the Windows subsystem to flush the page for some print drivers. ACUCOBOL-GT ensures that entirely empty lines are not sent to the device (only the form-feed will be sent). But it is essential that:
Your other option is to specify WRITE... BEFORE ADVANCING PAGE to avoid this potential problem.
If the user looks for the job in the spooler, it is named with the current title of the ACUCOBOL-GT window.