Using MS-DOS PRINT Spooler from Within FoxPro

ID: Q99547


The information in this article applies to:


SYMPTOMS

When you are printing very lengthy reports on non-Windows systems, the delay before printing begins can be quite long. However, when the same report is sent directly to the PRINT facility of MS-DOS, it will begin spooling immediately to the printer in the background.


CAUSE

The PRINT program has a resident portion that must be loaded into memory, which takes some time.


RESOLUTION

To avoid this delay, you can load the PRINT program before invoking FoxPro (consult your MS-DOS manual for other start-up options available for PRINT). This can be done by creating a batch file that first loads PRINT, and then loads FoxPro. The PRINT command expects confirmation of the default printer device the first time it is invoked. Since FoxPro should always use the default device PRN as its printer device, a file containing a single carriage return can be created and used with the MS-DOS input redirection character to automate the process. The output messages can also be redirected to the NUL device.

The following example assumes that you are using the MS-DOS 5.0 editor; if you aren't, make substitutions as needed.

  1. At the MS-DOS command prompt, type "EDIT OK.PRN" (without the quotation marks) and press ENTER. Press the ENTER key again, and then press ALT+F, X, and then ENTER to save the file.


  2. At the MS-DOS command prompt, type "EDIT FOXP.BAT" (without the quotation marks). Type in the following information:
    
          PRINT <OK.PRN >NUL
          CD\FOXPRO25
          FOXPRO
          CD\  


Press ALT+F, X, and then ENTER to save the file.

To begin a session of FoxPro with PRINT available, type "FOXP" (without the quotation marks) at the MS-DOS prompt and press ENTER. From within the FoxPro application program, the filename to be printed can be passed in a variable. For example, you can write a report to a file named BIGRPT.TXT, which you can then print as follows:

   REPORT FORM megalist TO bigrpt   && .TXT default file extension.
   fyl="BIGRPT.TXT"
   *-----or could have been:
   *-----   fyl=GETFILE("TXT","Select report to print")
   RUN PRINT &fyl 
NOTE: The resident portion of PRINT will reduce the amount of available conventional memory to FoxPro by approximately 40K. Therefore, running FoxPro with PRINT may not be optimal in every situation.

Additional query words: FoxDos spooler


Keywords          : 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: August 8, 1999