                        dBASE III Printer Check
            (PC Magazine Vol 4 No 7 April 2, 1985 PC Tutor)

     To determine, from within dBASE III, whether the printer is online
before the SET PRINT ON command is issued, you can create a small
PRNCHECK.COM program that will check the printer status and return an
error level of 1 if an error occurs, 0 if not.  Use DEBUG to create
PRNCHECK.COM.
     The program calls the printer interrupt, thus requesting printer
status.  It then checks for an error signal, which occurs either if
bits 5 or 3 are high (1) or if bit 4 is low (0).  The program sets the
ERRORLEVEL 1 flag if the printer is off-line or not connected.  To
implement PRNCHECK.COM, put it in a batch program:

A>COPY CON:PRNTEST.BAT
PRNCHECK
IF ERRORLEVEL 1 GOTO SETERR
ECHO STORE 'N' TO PRNANS >PRNSET.PRG
GOTO END
:SETERR
ECHO STORE 'Y' TO PRNANS >PRNSET.PRG
:END

     The batch program calls PRNCHECK.  If no printer error was
generated, it makes a file named PRNSET.PRG, containing the line STORE
'N' TO PRNANS.  If there was a printer error, the file contains the
line STORE 'Y' TO PRNANS instead.  Finally, your sequence of dBASE III
commands is:

RUN PRNTEST
DO PRNSET

This will run PRNTEST (setting up the file PRNSET.PRG to look like a
dBASE command), then DO the command, so setting up a variable named
PRNANS with value 'N' if there was no printer error, or 'Y' is a
printer error occurred.  Your dBASE program can then check the value
of PRNANS and do whatever you like.  Create PRNCHECK.COM with DEBUG
as follows:

A>DEBUG PRNCHECK.COM
file not found
-A100
xxxx:0100  MOV   DX,0000
xxxx:0103  MOV   AH,02
xxxx:0105  INT   17
xxxx:0107  TEST  AH,28
xxxx:010A  JNZ   0118
xxxx:010C  MOV   AL,10
xxxx:010E  AND   AH,AL
xxxx:0110  CMP   AH,AL
xxxx:0112  JNE   0118
xxxx:0114  MOV   AL,00
xxxx:0116  JMP   011A
xxxx:0118  MOV   AL,01
xxxx:011A  MOV   AH,4C
xxxx:011C  INT   21
xxxx:011E  <enter>
-
-RCX
CX 0000
:20
-W
Writing 20 bytes
-Q
