LPQUE
Queue a file for printing by the system
WTSupported in traditional Synergy on Windows
|
WNSupported in Synergy .NET on Windows
|
USupported on UNIX
|
VSupported on OpenVMS
|
LPQUE(filename[, LPNUM:device][, COPIES:number][, FORM:form_name][, ALIGN] & [, DELETE[:flag]])
Arguments
filename
The name of the file to be queued for output. The filename must conform to the form and restrictions imposed by the spooler device. (a)
LPNUM:device
(optional) Specifies the spooled print device to which the file is directed for output. Possible values depend on the spooler being used.
COPIES:number
(optional) Specifies the number of copies to print. Possible values depend on the spooler being used. (n)
FORM:form_name
(optional) Specifies the name of the form you want. The default is no special forms. The format of the form name depends on the spooler being used. On Windows, FORM only affects printing if system option #22 is set.
ALIGN
(optional) On Windows and UNIX, ALIGN indicates that a spooler-defined alignment pattern is to be created and accepted by the system operator before the file contents are printed. This alignment depends on the spooler being used. On Windows, ALIGN only affects printing if system option #22 is set.
On OpenVMS, ALIGN tells the system spooler to place the entry on hold.
DELETE:flag
(optional) Specifies whether the file will be deleted after it is printed. If flag is a nonzero value, the file won’t be deleted. If DELETE is specified but flag is not specified or is zero, the file will be deleted. By default, if DELETE is not specified, the file won’t be deleted. (n)
Discussion
The LPQUE statement queues a file for printing by the system. This statement relies closely on the spooling facilities offered by each operating system. Not all systems provide support for each of the LPQUE options. LPQUE works in conjunction with system option #22, which determines how LPQUE interfaces with the operating system, and (on Windows) the PRINT_METHOD environment variable.
When specifying a filename, the default extension is .ddf. To print a file with no extension, append a period (.) to the end of the filename. For example:
lpque ("filename.")
If you don’t specify the COPIES qualifier, or if number is less than 1, one copy is printed.
Using LPQUE on Windows
On Windows, LPQUE is deprecated in favor of the Synergy Windows printing API. It is not compatible with remote terminal services printers and on-demand printer driver loading. |
The LPNUM value must be an alpha variable specifying the printer device in the form “name, [device]”, unless system option #22 is set. If system option #22 is set, the runtime sends LPQUE arguments to the file DBLDIR:dblpq.bat, which can contain customized print commands. You must create your own dblpq.bat file. The LPQUE options specified in your Synergy program are passed as arguments to dblpq.bat. These arguments can then be processed as replaceable parameters (%1, %2, %3, etc.) within dblpq.bat. Although not all systems support all of the LPQUE options, a value is passed for each as shown in the table below.
DBLPQ argument |
LPQUE option |
Possible values |
Default value |
---|---|---|---|
%1 |
filename | ||
%2 |
LPNUM | 0 - 99 | 0 |
%3 |
COPIES | 0 - 99 | 1 |
%4 |
FORM | "string" | NOFORM |
%5 | ALIGN | 1 or 0 | 0 |
%6 | DELETE | 1 or 0 | 0 |
The following table shows examples of LPQUE statements and the arguments they send to dblpq.bat:
LPQUE statement |
DBLPQ arguments |
---|---|
lpque(“test.ddf”) |
TEST.DDF 0 1 NOFORM 0 0 |
lpque(“test.ddf”, lpnum:1, copies:2) |
TEST.DDF 1 2 NOFORM 0 0 |
lpque(“test.ddf”, lpnum:1, copies:2, form:var) |
TEST.DDF 1 2 VAR 0 0 |
lpque(“test.ddf”, lpnum:1, copies:2, align, delete) |
TEST.DDF 1 2 NOFORM 1 1 |
When using LPQUE with xfServer on Windows, we recommend that the client generate a print file locally and then print it on a printer accessible to the client. We do not recommend that the client print a remote file using xfServer; however, if you choose to, the printer must be attached directly to the server machine. Network printers are not supported from xfServer on Windows.
The default printer is used unless specified otherwise with the LPNUM argument. If no printers have been defined, LPQUE will fail. If you are using UI Toolkit, you can call the %U_PRINTSETUP routine to display a Windows printing dialog and let the user choose a printer.
LPQUE is not allowed on devices. We recommend that you don’t you use LPQUE from a service (such as dbssvc), but if you do, you must modify the service to run as a user account that has previously set up the printers that will be used as well as a default printer. In addition, if LPQUE is used with a remote LPQUE to xfServer or under xfServerPlus, the ENABLEUSERHIVE registry setting must be set. See Defining environment variables for a specific user for instructions on setting ENABLEUSERHIVE. In Synergy .NET, LPQUE requires the main program to have the [STAThread] attribute; therefore, Synergy .NET can’t use LPQUE within IIS. LPQUE and the underlying Windows COM/print drivers are not thread safe, so you should ensure that only one thread at a time uses LPQUE. |
Using LPQUE on UNIX
You can customize printing on UNIX by modifying the DBLDIR:dblpq shell script file to your own specifications. The runtime sends LPQUE arguments to this file if system option #22 is set. The LPQUE statement then executes the arguments in dblpq instead of those in the default printing program (lp).
If you don’t have a printer connected but you want to test your programs, you can set the environment variable PCMD to cat to make LPQUE to send your output to your terminal.
You can either specify the printer number or the printer name (in quotation marks) as the argument to LPNUM, although an alpha printer name specification is not portable to all operating systems.
Using LPQUE on OpenVMS
You can use the LPQUE statement to add a job to the print-batch services queues. If you use LPQUE, the default condition is to use the $SNDJBC system service, which speeds up spooling. The drawback to this is that you can’t use wildcard characters in the file specification, and print switches on filename specifications are ignored.
LPQUE can also be used to submit batch jobs if its queue is a batch queue. However, if you specify system option #22, Synergy DBL constructs a DCL PRINT command line and spawns a subprocess to execute the PRINT command line. With this option, you can use wildcard characters, and valid print switches on a filename will be sent through to subprocesses as part of the PRINT command line. If system option #22 is set, printing errors may not be reported to your program.
To use the additional parameter SJC$_NO_PAGINATE, which is equivalent to using a PRINT/NOFEED DCL command, set DFLAG flag 8.
Examples
The following example sends the file test.1st to the print queue, prints three copies, and then deletes the file.
lpque("test.lst", copies:3, delete)
The following example sends the file, which is named in the variable file, to the printer to print aligned, and with the labels form. The file is deleted after printing.
lpque(file, form:"1-part", align, delete)