Monday, 1 December 2008

Setting up OpenVMS DCPS for wide 132 column portrait printing to an LPD network printer

Summary: by using DCPS and a custom ANSI setup you can print 132 column in portait mode to a postscript LPD printer. My Kyocera FS1020D has a network card installed and is setup as an LPD printer server. 132 column portrait is useful for printing compiler or assembler list files.

Install DCPS. For hobbyists the license is included: DCPS-OPEN


I made the following alterations:

Define the DCPS_LIB logical to point to the standard control library located in SYS$LIBRARY:DCPS$DEVCTL.TLB, and a user defined library (to be created in a minute) called SYS$LIBRARY:DCPS$SITE.TLB. The directory and file extensions are not specified in the logical, but we must specify that our custom library contains ANSI control sequences:


If in Europe define the default paper size as A4:


Then define the printer execution queue:

SYS$PRINT - ! P1 - Execution queue name
"IP_LPD/" -! P2 - Interconnect protocol/device name
DCPS_LIB - ! P3 - Logical name for library(ies)
"SIDES=2" - ! P4 - Default queue parameters
"/SEPARATE=(NOBURST,FLAG)" - ! P5 - Default queue qualifiers
"" - ! P6 - Communication speed (serial only)
"" - ! P7 - Device characteristics
"" ! P8 - Verify on/off

Significant parts of this file are the parameters:

P1 - if you specify this as SYS$PRINT you'll not need to specify a queue name when printing
P2 - protocol of IP_LPD specifies we are printing to an LPD printer - followed by the IP address and the name of the print queue (the default remote queue name is normally lp)
P3 - this is the logical name defining the form library(s) the queue users (the one we defined earlier in this file)
P4 - SIDES-2 my FS1020D is a duplex printer - this specifies duplex printing

You need to define a setup module and add it to a text library. The setup module is a string of ANSI control sequences that are interpreted by the DCPS print engine. The setup module can either be defined directly in the PRINT command using the /SETUP parameter or via a FORM definition.

The following text file sets up the printer for 132 character portrait printing:

$ type sys$library:wide132.txt

where ESC is the escape code Ctrl-[. You can create escape characters within EVE by typing Ctrl-V Ctrl-[

Breakdown of the ANSI control string:

ESC[15m - select line printer font
ESC[11w - select horizontal pitch
ESC[1;132s - select left and right margins

To create the custom control library (initially empty):
$ library/create/text sys$library:dcps$site.tlb

To replace the module in the custom control library (note that the library extension .TLB and text file containing the ANSI control sequence .TXT are not specified):
$ set def sys$library
$ library/replace/text dcps$site wide132

(If previously created) delete the form to use:
$ delete/form wide132

Create a form using the /setup parameter to define the module to use. The /stock-default is required unless you are using a specific stock:
$ define/form/width=132/setup=wide132/stock=default wide132 2

You should now be able to print using the following:
$ print/form=wide132 myfile.lst

The DCPS$STARTUP.COM and form definition commands needs to be added to the SYS$STARTUP:SYSTARTUP_VMS.COM file to get run automatically at startup.

Note: the only reference I could find to setting the horizontal pitch in relation to DCPS used the command ESC[4w which sets a pitch of 16.5 characters/inch. This apparently works on dot matrix printers but not on my Kyocera FS1020D because of the minimum margins imposed by the printable area (probably true of a number of laser printers). You get 131 character lines - very frustrating! The setting of ESC[11w uses a slighter tighter pitch of 17.1 characters/inch (which seems designed for this purpose in my opinion).

This is an excerpt from the the Digital ANSI-Compliant Printing Protocol Level 2 Programming Reference describing the horizontal pitch command:

DECSHORP—Set Horizontal Pitch
Selects character spacing for monospaced fonts.
Source: Application Destination: Levels 1, 2, 3
CSI Ps w
9/11 *** 7/7
The DECSHORP command determines the number of characters/inch (pitch)
that the device uses. This establishes the Horizontal Advance Increment
The selective parameters for DECSHORP are as follows:
Ps HAI Pitch
0 720 centipoints 10 characters/inch
1 720 centipoints 10 characters/inch
2 600 centipoints 12 characters/inch
3 545 centipoints 13.2 characters/inch
4 436 centipoints 16.5 characters/inch
5 1440 centipoints 5 characters/inch
6 1200 centipoints 6 characters/inch
7 1090 centipoints 6.6 characters/inch
8 872 centipoints 8.25 characters/inch
9 480 centipoints 15 characters/inch
11 420 centipoints Approximately 17.1 characters/inch or, more
accurately, 14/240 in.
12 840 centipoints Approximately 8.55 characters/inch or, more
accurately, 28/240 in.
13 400 centipoints 18 characters/inch
14 800 centipoints 9 characters/inch
15 720 centipoints 10 characters/inch

my WIDE132.TXT file