Niakwa, Inc.



What's News
NPL Products
NPL Support
NPL Downloads
System Integration
swiggle_small.gif (991 bytes)

swiggle_small.gif (991 bytes)

April 5, 2000 No. 93

Suppressing DOS Printing Errors

When an application runs unattended for a significant amount of time, it may be desirable to suppress the “Abort/Retry/Fail” message that displays as a result of printer problems  (e.g. the printer has run out of paper), because such displays halt program execution.  Runtime versions 4.20.03 and later have the functionality to block these error displays in a DOS environment (this functionality does not apply to a Windows environment).

 To suppress these dialogs within NPL, set bit HEX(40) of $OPTIONS byte 42.  This setting effectively selects the ‘Fail Operation’ automatically whenever a printer problem invokes the error display.

 NPL printing operations normally ignore all errors.  The ERR=Y clause must be included in the $DEVICE specification for NPL to generate a printing-related error.  The resulting NPL error is recoverable and may be trapped by an error handling routine. 

 For example, the following code allows you to detect and recover from a failed print operation:

 0010 $DEVICE(/215)=”LPT1 ERR=Y"DIM O$64

          STR(O$,42,1)=OR HEX(40):    ;Automatically fail all Abort/Retry/Fail displays
       $OPTIONS =O$
       SELECT PRINT 215
          ;If the printer is not working, the error trap handles the NPL error
       PRINT “Generate an error if printer is not online”
       ERROR DO
               SELECT PRINT 005
         PRINT “The printer is not working”
       END DO

 In general, this $OPTIONS bit should be set only if testing for a printer off-line condition, or if every PRINT statement that could be directed to a printer has an appropriate error trapping routine.

 If every print statement in an application has a corresponding  “ERROR DO/END DO” statement, unattended programs should continue to run successfully even when the host operating system reports a printing error. 

 Note:  The above routine will work properly in a DOS environment only.  The routine does not apply to a Windows environment.


blank.gif (841 bytes)

Niakwa, Basic-2C and NPL are trademarks of Niakwa, Inc. All other products mentioned are registered trademarks or trademarks of their respective companies.

Questions or problems regarding this web site should be directed to
Copyright 1996-2010 Niakwa, Inc. All rights reserved.
Last updated: Thursday January 07, 2010.