DEVICE

Updated and reviewed September 2011

Windows:

DEVICE = <printer device>

DEVICE = <printer device> | <alternate name>

Linux:

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:.

Windows 95/98/ME: You can specify one or two names (separated by a vertical bar) where each is either a descriptive name or a hardware device name. The format and usage of these names varies between different versions of Windows. For W95/W98/ME, the descriptive name is the name that appears under the printer icon (e.g. "HP LaserJet Series II") and it can be changed by right clicking on it and selecting the rename option. The hardware device name for local printers is the port that the printer is attached to (e.g. LPT1:), and for remote printers, it is the UNC (Universal Naming Convention) share name (e.g. \\server\hp2.)

NT/W2000/XP: The descriptive and hardware device names for local printers are just as they were for earlier versions of Windows. But for remote printers, the descriptive name is actually the UNC share name (e.g. \\server2\hp2), although it will appear under the icon formatted something like "hp2 on server2". You cannot change this kind of printer name (except by redefining the share name on the system which owns the printer). The hardware device name will be a network port name like Ne02:.

Because of these semantic differences, A-Shell allows you to 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

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.)

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

As of A-Shell build 1150 of June 2009: 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.)

Linux: You must specify a valid printer queue name. These are the names that can be specified in the P switch of the lpr (Linux) 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 Linux 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 Linux, 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.