DEVICE

Revised and reviewed July 2020

Windows:

DEVICE = <printer device>

DEVICE = <printer device> | <alternate name>

UNIX:

DEVICE = <printer device> {optional switches}

This defines the host printer queue or device to be used for the given A-Shell printer whose name matches the name of the printer initialization file. The syntax and semantics of the device specification vary with the host operating system. Note that in addition to actual printers, A-Shell supports the pseudo-devices DEVICE = AUXLOC:, DEVICE = PROMPT:, and DEVICE = DISK:. Removed XP reference, re-wrote Windows part. JM reviewed July 2020.

Windows

: The <printer device> and <alternate names> may either be descriptive names for the printers as they appear in a standard Windows printer selection dialog box (e.g. , PDF-XChange or Brother HL-5250DN), or in case of shared printers, a UNC share name, e.g. \\server\hp2.

In order to provide flexibility for heterogeneous networks where different workstations may see the same printers differently, you can specify two device names separated by a vertical bar, as shown here:

DEVICE = HP LaserJet | \\server2\hp2

In this case, if the first name cannot be found, the second name is used. This can be useful in heterogeneous networks where it might be difficult for every workstation to refer to a particular printer by the same name.

Notes

See History below for additional notes.

Network printers do not need to be locally defined as long as the local machine can access the target printer by means of the \\machine\sharename of the printer. To take advantage of this, the DEVICE statement must specify the \\machine\sharename by itself, or as the second choice (after the vertical bar) if there are two names (as in the example above).

If it is not possible for all workstations in a network to refer to a shared printer by the same device name (or by either of a pair of alternate names under Windows), and if it is not possible for the application to allow different users to refer to the same printer by different names, then you may have to arrange for these workstations to have their own private ASHCFG: directory (or DSK0:[1,4]) so they can have different versions of a particular <printer>.pqi or <printer>.ini file. Refer to the miame.ini DEVICE statement.

If you are having difficulty figuring out the proper DEVICE specification for your printer, turn on line printer tracing (see Troubleshooting Techniques) and then print a sample file. It will display information showing you which printer names from the Registry it is trying to match against your device.

Printer names given in the DEVICE statement under Windows are not case sensitive, and do not need to be complete. For example, "DEVICE=HP" will match "hp LaserJet" (but not "jet HP"). Be careful, however, to make the name long enough to be reasonably unique, because A-Shell will stop on the first printer that matches. (So in the case of "DEVICE=HP", if you had both an "HP LaserJet Series 4" and an "HP DeskJet", it would match whichever one appeared first in the Registry.)

UNIX

You must specify a valid printer queue name. These are the names that can be specified in the P switch of the lpr (UNIX) or enq (AIX) commands. (A-Shell submits the file to the printing subsystem by creating and then executing an lpr or enq command line based the specified, file, printer, and other options.)

A copy of the actual command line created and submitted for each print request, along with any error response, is written to the log file opr:spool.log.

Because UNIX spool commands may support additional switches that are not directly analogous to PRINT or XCALL SPOOL parameters, or otherwise not supported by A-Shell directly, you may add any such parameters after the spooler name, as shown here:

DEVICE = laserque 1 -c -o sides=two-sided-long-edge

In this example, the spooler name is laserque1, and the additional arguments -c -o sides=two-sided-long-edge are added to the command line created which is automatically generated, based on the file, operating system, and other parameters passed to the A-Shell spool request. (The -o sides=two-sided-long-edge option illustrates a way of implementing duplexing under UNIX, even though the DUPLEX printer init command is not supported except under A-Shell/Windows.)

The –c switch generally causes most UNIX spooler commands to make a local copy of the file before printing it, thus eliminating conflicts which might otherwise occur if the application then proceeded to erase or modify that file before it was done printing. See the discussion about deleting files (DELETE) for more comments on this topic.

History

2019 December, A-Shell 6.5.1672:  Add LASTPROMPT: function

2019 November, A-Shell 6.5.1671: If you know the exact and complete name of the printer, you can eliminate the normal logic which enumerates the available printers in order to determine the best match, by preceding the name with an asterisk. This could potentially be useful in certain environments where the printer enumeration operation was hanging, taking too long, or otherwise causing problems. For example:

DEVICE = *PDF-XChange Printer 2012

2009 June, A-Shell build 1150: If a printer is known to exist but A-Shell fails to find it in the matching logic, you can set the first character of the printer name in the DEVICE statement to lower case (e.g. DEVICE = hP Laser), in which case if it fails to find it in the directory, it will trust you and just try to open it blindly. (This has long been the procedure for printers using share names like \\server\name.)

2009 May, A-Shell build 1148:  Windows printer names can be up to 100 characters in length. The previous limit was 50.