LabelVision Classic: Technical Notes

Using the FILEWAIT utility for automated printing
This technical note describes how to use the FILEWAIT utility to set up an automated label print station using LabelVision which can receive data from one or more remote computers. You must have LabelVision Professional to use FILEWAIT. FILEWAIT comes with a help screen, accessed by typing "FILEWAIT /?" at the DOS command line.

In this note, we assume that you are dedicating a PC to LabelVision to act as an automated (i.e., no operator input) print station. We'll call this the Print Station. You have one or more other computers which send the data for the labels. We'll call this the Sending Computer.

Data is transferred from the Sending Computer to the Print Station via an ASCII Text file. As soon as the Sending Computer creates the file, the Print Station "grabs" this file (changes its name) and begins printing it. The Sending Computer can send a second file while the Print Station is printing the first one.

The FILEWAIT program is run as part of the application on the Print Station. It waits for the data file and grabs the file, all in a single operation. This prevents any data contention or sharing errors.

The Sending Computer creates a queue file (we'll call it QUEUE.TXT in this example). FILEWAIT renames this file to a print file (we'll call it PRINT.TXT in this example). We'll assume that the files are located on a network drive G:. Change to your own drive letter as appropriate.

For a sample FILEWAIT application, look in the SAMPLES\FILEWAIT subdirectory under your LabelVision installation directory.

To create an application with FILEWAIT:

  1. The Print Station and the Sending Computer must be connected with some kind of DOS compatible network or terminal emulation program. The Sending Computer must be able to create a file which can be read by DOS running on the Print Station.
  2. Create an application which will be run on the Print Station. This application consists of the following items:
    • A repeat counter which starts at 1 and has an end value of 999999 (effectively an infinite loop).
    • Run a DOS Program item with the constant value "FILEWAIT G:\QUEUE.TXT PRINT.TXT". If you want to change the polling delay (as described below), place the new polling delay after a space at the end of the command line.
    • An ASCII Text File item. Use the file name G:\PRINT.TXT. Format the item to include all the fields of data that must be transmitted from the Sending Computer. You may include the Label Quantity as one of these fields.
    • Print label XXXX.LAB (the name of your label file). Associate each of the fields in your label with a field in the ASCII Text file. Also, turn off the "Operator Review before printing" option.

  3. Use a DOS .BAT file to call LPRINT with this new application. Use the syntax "LPRINT /X NOSWAP /L appname". The NOSWAP option will speed up program execution. For more information see Technical Note TN-0021.

    The Sending Computer might be an IBM mainframe, a VAX, or another PC. There are two approaches to how data is transmitted from the Sending Computer. In the first option, the Sending Computer waits for a label to be processed before transmitting the next label. This option is typically used if the Sending Computer is a process on a mainframe. In the second option, the Sending Computer creates a queue of data to be printed. This would typically be the case if the Sending Computer is another interactive PC on the network.

    1. If the Sending Computer is going to wait for the data to be printed, then the sending computer should work as follows:
      1. Wait until the file QUEUE.TXT does not exist.
      2. Open the QUEUE.TXT file
      3. Write the data to the QUEUE.TXT file
      4. Close the QUEUE.TXT file.
      5. It is important that you only open the QUEUE.TXT file once. After you close the file, it will immediately "vanish" when the Print Station sees it.
      6. Goto step 1.

    2. If the Sending Computer is going to queue the data for more than one label, then the QUEUE.TXT file will have one record per line. Each line is data for a different label. The Sending Computer should work as follows:
      1. Try to open the QUEUE.TXT file for append, creating it if it is not found. Note that the Print Station or another Sending Computer may have this file open, so you must trap this open for sharing errors. If a sharing error occurs, simply wait a short time and try again.
      2. Append the records to the end of QUEUE.TXT.
      3. Close the QUEUE.TXT file.
      4. Goto step 1.

  4. Run the application on the Print Station, and test that it works. You should test all conditions, especially keeping the QUEUE.TXT file open for long periods of time. By default, the FILEWAIT program "polls" the file every 1/10 of a second. The optional third parameter of FILEWAIT specifies the polling delay, in milliseconds.


Send mail to
webmaster@labelvision.com with questions or comments about this website.
Copyright © 2014 Flexible Information Systems, Inc.