AIX Printer Support: Colon Files
Jeff Courington
One of the first questions your manager will ask when
he/she finally
decides to jump on the open system bandwagon is "Can
we use all
of our current terminals and printers on the new platform?"
I
was asked this question before my company purchased
10 IBM RS/6000's
as badly needed replacements to our aging MAI/Basic
4 systems. MAI
were very helpful in answering the hardware side of
the question:
most of the current terminals and printers would work
with some minor
changes and converter boxes, but some of the older equipment
would
have to be replaced. I soon discovered, however, this
was only a small
part of the solution. Since these were non-supported
printers, many
functions -- such as form length, cpi, and lpi -- were
not available.
So the question became "How do you regain the functionality
of
non-supported printers?" AIX's answer is called
the colon files.
A colon file is simply a text file that can be used
to control characteristics
of the printer. A stack-based language is used to pass
commands, and
the colon file is compiled by the chvirprt command.
The resulting
"digested" file is used by the formatter programs.
The formatter
is actually a C program that acts as a filter to perform
the tasks
defined by the colon file. The formatter to be used
is specified on
the mf line of the colon file. The pio commands load
the colon file to find which formatter is to be used
and then load
the appropriate formatter. If you have a lot of time
to waste you
can actually write a formatter, but the ten that IBM
has supplied
should work for most of your needs. Once you've seen
these files,
the reason for the name becomes obvious.
I was first introduced to colon files through two internal
IBM documents
-- "Printing for Fun and Profit Under AIX V3"
and "Printer
Formatters, Colon Files and Virtual Printers."
The internal document
number for the first is GG24-3570. The second document
does not have
an internal document number but the majority of the
information it
contains is in info explorer under "Printer Colon
File Conventions"
and "Printer Colon File Escape Sequences."
The printer I needed to configure was an MAI 4201. This
is almost
a Printronix P6000 series printer. MAI made some hardware
modifications
to allow their system to communicate, but a converter
was supplied
to negate those changes.
Standard Configuration
To start working on a non-supported printer, first configure
the printer
as another serial printer, that is, a generic RS-232-type
printer,
then add a virtual printer of type ASCII. This gives
you a clean colon
file to start.
Form Length
Most newer printers allow form length to be loaded by
a simple escape
sequence, e.g., ESC C n, where n is the number of lines
per page, but this printer used a method called vertical
form units
(VFU). A short explanation from the hardware reference
manual summarizes
VFU as a device that permits executing forms of up to
132 lines in
length and allows slewing within a form. To accomplish
this task with
hex codes requires the following:
1E 10 1D ... (number of
lines - 1) ... 1D 1F.
The 1E tells the printer that you are starting
to load a VFU; the 10 signals the printer that this
is the
top of the form. The 1D values are place holders for
the rest
of the lines on the form, and there are number of lines
per page
- 1 of these. The top of form accounts for the need
to use -1.
The 1F tells the printer that you have finished.
To accomplish the same thing with a colon file requires
a different
procedure. The files can be found on AIX 3.1.x in the
directory /usr/lpd/pio.
Changes will be kept in the directory /usr/lpd/pio/custom.
The file names are <virtual printer>:<physical
printer>. Predefined
colon files are in the directory /usr/lpd/pio/predefs.
Printout
headers are in the directory /usr/lpd/pio/burst. After
the
colon file is compiled by the chvirprt command, the
"digested"
file is placed in the /usr/lpd/pio/ddi directory. This
is the
file that is actually used by the formatter programs.
If the colon
file is not re-compiled the changes will not take effect.
On version
3.2 these directories were changed to /var/spool/lpd/pio.
A clean colon file would resemble Listing 1. The relevant
entries
are as follows:
:076:_j::1
:079:_l::66
:144:ci::
:183:eC::
_j is a boolean used to decide if form length
needs to be loaded. _l is the number of lines per page.
ci
decides whether or not to load form length by looking
at _j.
eC loads form length.
The modifications look like this:
:144:ci::%?%G_j%{1}%=%t%I[eC,al]%?%Gwp%t%I[c2,
eB,eD,e%]%;%;
:183:eC::%?%G_l%t%G_l%{1}%
-%Pa\36\20%wa\34%;\37%e%o%G_l%r%t%\33C%o%G_l%r%c%;
The first clause
:144:ci::%?%G_j%{1}%=%t%I[eC,al]%?%Gwp%t%I[c2,
eB,eD,e%]%;%;
says, in English,
If the value of _j is equal to 1
then run the eC clause and the al clause
If the value of wp is not equal to 0
then run the c2, eB, eD, and e% clauses.
The last if clause is the standard ASCII printer
clause and can be removed.
The important clause is the eC clause. You should be
aware
that this clause does not even appear in the standard
colon file.
I found this number by looking at the IBM ProPrinter
colon file and
used it as a rule of thumb.
The second clause
:183:eC::%?%G_l%t%G_l%{1}%-%Pa\36\20%wa\34%;
\37%e%o%G_l%r%t%\33C%o%G_l%r%c%;
says, in English,
if the value of _l is not equal to 0
then subtract 1 from _l and put it in the
a register
send octal 36 and octal 20
while a does not equal 0
send octal 34 and send octal 37
else use original options from database
push _l on the stack
reset the value before %o was used
then send octal 33 the character C
use original options from database push _l
reset the value before %o was used
pop integer off of stack and use low order byte.
The else phrase is a standard loading of form
length for an IBM ProPrinter. The values are first set
to the originals,
in case you changed something, then reset. The code
looks to see if
a form length is set, then sends octal 33 to the printer
along with
the ASCII value of C. It reloads the original values,
pushes the value
of _l, and resets values, then pops values of _l. Listing
2 shows
a more technical breakdown of the information. Figure
1 displays the
command set.
You can make these changes through smit -- you change
the
virtual printer, which causes an automatic recompile.
I usually bypass
this and use the vi editor, but I then must manually
recompile
using the following command:
-> chvirprt -d<physical
printer> -q<virtual printer>
If doing it yourself seems too complicated, IBM says
they may help (see sidebar).
Don't be nervous about changing the colon files -- the
original
can always be recovered by deleting the virtual printer
and redefining.
This example is only the beginning of what can be done
through with
colon files. If you want an explanation of the other
values, use smit
to change/show virtual printer. The result will be a
list that consists
of a two-character description, its purpose, and possible
values.
About the Author
Jeff Courington graduated from Virginia Polytechincal
Institute
and State University with a BS in Computer Science.
Over the past
eight years, he has worked on various forms of UNIX,
including AIX,
SCO, SVR3 variants from Silicon Valley Software and
Versyss Corporation.
He presently runs a network of 10 IBM RS/6000's and
various SCO machines
connected by X.25 over the wide area and Ethernet on
the local area,
also running TCP/IP over X.25.
|