How can you detect if a printer is on or off when running a COBOL program on a Windows platform?
This can be done using the WIN$PRINTER routine and specifying the WINPRINT-GET-PRINTER-STATUS op-code. There is a sample program called prndemox.cbl that demonstrates the use of the WIN$PRINTER routine.
It can be found the Sample sub-directory where ACUCOBOL-GT is installed, e.g.:
It requires 4 copybooks:
It is also attached to this KB Item.