Landscape and Portrait Printing, Printer Device Control Libraries
OpenVMS printing using landscape page orientation is most commonly accomplished using the DECprint Services (DCPS) package when the target printer supports Postscript printing. For non-Postscript printers, the most common solution for selecting landscape involves the creation of a landscape module and a reset module — these are really just text files — for the printer, and inserting these modules in the SYSDEVCTL.TLB device control library, or creating a printer-specific device control library for specific requirements, and configuring the printer queue accordingly.
Two general types of printers are discussed here, generic HP PCL-based printers, and specialized printers such as the Dymo LabelWriter SE300 thermal label printer.
You will require the manual(s) for your printer.
Most printers will power up in portrait orientation. This is true of typical HP PCL printers, and of the Dymo LabelWriter SE300, and most every other printer. These printers can then require a device-specific sequence be inserted into the data stream, and this sequence then causes the printer to switch to landscape orientation, or whatever the particular required mode might be.
At its simplest, the device control library mechanism can be used to insert these printer-specific sequences into the printer data stream on behalf of the users and applications. Beyond the mechanism used to embed the character sequences into the data stream, there is nothing specific nor unique to printing OpenVMS here, these sequences and mechanisms are wholly and entirely printer-specific.
The Dymo LabelWriter SE300 uses its set print orientation command (GS V) sequence. This sequence is comprised of a hexadecimal Group Separator (GS) character (GS is hexadecimal 1D, decimal 29), followed by the ASCII character codes for the character sequence “V1”, “V2” or other such. The specific V1, V2 and such distinguish which mode and resolution is selected.
Interestingly, the Dymo LabelWriter SE300 manual has a commendably complete list of descriptions and sequences and code examples; based on a cursory review, this manual appears well written and surprisingly complete. Some printers have no manuals, or have manuals that are incomplete, ambiguous or wrong.
What you put in your module will be specific to the HP PCL printer, the Dymo SE300 printer, or whichever printer you are working with. You will need to acquire and review the printer documentation.
Most printers will require entering ASCII characters by code point; by the hexadecimal or decimal value associated with the character. To create ASCII key values to be inserted into the text module you're creating, you can use a DCL command procedure as shown in examples here, or you can often use CTRL/V (^V) in TPU or EVE, or the SPECINS (Gold-KP3, IIRC) in EDT, followed by the associated control code. For details on these control sequences, see a terminal manual or a table of ASCII character codes.
As a quick example, the following DCL creates a file containing the character sequence for a Dymo LabelWriter SE300 printer, and a Hello World message. Create the file, then print it to the Dymo SE300. The following is a rough DCL translation of part of an example from the appendix of the Dymo SE300 manual:
$ close/nolog foo $ open/write foo x.tmp $ esc[0,8] = 27 $ gs[0,8] = 29 $ lf[0,8] = 10 $ vt[0,8] = 11 $ ff[0,8] = 12 $ write foo esc "*" + gs + "t" + vt + gs + "V1" + "Hello" + lf + "World" + ff $ close/nolog foo $ exit
The above example shows the sequence on one command line, as DCL does not provide a mechanism to suppress the carriage return and line feed sequence; the CR LF sequence.
This is a rough test case, and the printer will likely require a reset or a power-cycle sequence; the sequence shown switches the printer into landscape, but does not switch it back. The sequence used in the example does not include the printer reset sequence.
The following is a similar sequence of DCL for a PCL printer, though this sequence generates the files necessary for PCL-based landscape printing, and generates a PCL reset module.
$ esc[0,8] = 27 $ close/nolog foo $ open/write foo sys$scratch:landscape_pcl.tmp $ write foo esc + "&L10" $ close/nolog foo $ open/write foo sys$scratch:reset_pcl.tmp $ write foo esc + "E" $ close/nolog foo $ library/create/text/insert sys$common:[syslib]sysdevctl_pcl.tlb - sys$scratch:landscape_pcl.tmp, sys$scratch:reset_pcl.tmp $ exit
When you are satisfied with the sysdevctl_pcl.tlb library, copy the library into the system common directory sys$common:[syslib]. The queue is then initialized with a DCL command similar to:
INITIALIZE/QUEUE/BATCH/LIBRARY=sysdevctl_pcl.tlb queue_name
Additional and site-specific qualifiers are likely required on this command.
Using the device control library means you can use more standard means for creating the file, and need not embed these characters in the data stream.
Once the modules are established, set up the forms appropriately, and associate the form with a particular queue. The following shows how to define the form as a setup module for the queue, sets up a reset module for the queue, and then shows a PRINT command:
$ DEFINE/FORM/DESCRIPTION="PCL Landscape setup"-
/SETUP=landscape_pcl ... landscape_pcl form_number
$ SET QUEUE/FORM_MOUNTED=landscape_pcl landscape_queue_name
$ SET QUEUE/SEPARATE=RESET=reset_pcl landscape_queue_name
$ PRINT/QUEUE=landscape_queue_name filename.txt
You can also perform a one-off specification of the module to test the form using PRINT /SETUP, though (for various reasons) HoffmanLabs recommends establishing the forms and the reset sequence, and not using PRINT /SETUP.
Duplex, Staplers, Stackers
These same basic techniques can be used to control the duplexer, stapler, stacker, paper feed, font cartridges, character set support, or any of various other mechanisms that might be available within a particular printer. Using the printer-specific sequences, you can select one-sided or two-sided printing, a printer-specific header page, or most any other attributes that might be available.
OpenVMS print symbiont SMBSRVSHR.EXE itself recognizes certain control sequences, such as:
Esc ] VMS ; 2
Or using eight-bit character codes:
OSC VMS ; 2
This control sequence suppresses the formfeed (FF character) separator between jobs; some printers insert this formfeed automatically, and (without the use of this sequence) OpenVMS can generate a blank page.
Yes, it appears that Esc ] VMS ; 1 wasn't generally useful. If it exists.
Non-Standard Serial Printers
With a typical serial printer, in-band flow control — XON and XOFF — is used. Some printers, intelligent controllers and other such devices can use non-standard devices, and these can cause problems with flow-control and/or with the device itself.
In typical serial devices, you can and do want some form of flow control enabled, whether in-band XON/XOFF or (if your hardware device and your serial controller supports it) hardware flow control. Most OpenVMS devices use XON/XOFF.
To disable most serial terminal character processing, you can issue the command SET TERMINAL /PASTHRU /PERMANENT. This permits most ASCII characters to pass, though the device driver will continue to honor XON/XOFF flow control.
Regardless, you will want to disable broadcast reception on the printer using SET TERMINAL /NOBROADCAST /PERMANENT or such.
Added Resources and Links
Additional DCL control sequence examples are available here at HoffmanLabs, and there exists a write-up on device control libraries at the HP Ask The Wizard (ATW) area in topic (5271); the ATW is no longer active, though materials remain available.
This article was inspired by an actual ITRC posting.
PCL5 Device Control Sequences, Font Tests
PCL device control sequences, and font tests, courtesy of Rich Hearn. These sequences have reportedly been successfully used with PCL5-capable Canon imageRunner series including the 330-400, 3235, 3320, 3570, and 5050 series printers, and with various HP LaserJet printers with PCL5.
The † is the Escape character.
Device control sequences
Portrait compressed (16.5-16.7)
†P†&l0o†&k2S†\
Landscape &l1o (oh) 12.0 pitch:
†P†&l1o†&k4S†\
Standard pitch 10.0:
†P†&l1o†&k0S†\
Classic PCL Reset:
†]VMS;2†\†P†E†\
Font Tests
The following are sequences that can be used to test a particular printer and its PCL font capabilities.