Create a printer-control table
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
It is important to note that control sequences are hardware dependent. Applications with hard-coded printer-control sequences are not easily transportable. You cannot change the print devices that the application accesses without changing the hard-coded printer-control sequences in the application. To bypass this obstacle, create a printer-control table which contains a record for each printer on your system. Each record in the printer-control table must contain a field for the name of the print device and several other fields containing a corresponding set of standard control sequences.
There is no easy way to employ an ABL UPDATE statement
to interpret the printer-control sequences and enter them into a printer-control
table. For example, the ABL UPDATE statement interprets
the octal sequence ~017 as the character string, as shown:
|
Instead of the proper code sequence:
|
You can create a system administration procedure that lets you convert printer-control sequences into the appropriate ASCII character strings, and store the printer-control sequences as ASCII character strings in the fields of a printer-control table.
Keep the printer-control table up to date with a record for each printer on your system. The following image shows a sample printer-control table.

The field containing the print device name must index the table. In this sample control table, the outdev field indexes the table.
To access the proper control sequences for a printer from a printer-control table,
set up an include file to determine the print device used in the
application, then substitute the corresponding control sequences
into the PUT CONTROL statements of the application.
For example:
|
The include file searches the Usrprnt table to determine the output device (Usrprnt.outdev) for the current user ID. After determining the output device, the include file searches the printer-control table to find the appropriate control sequences for the current printer. Notice that the printer-control table contains a default entry for the default printer.
The PUT CONTROL statements in your application should
use a field in the printer-control table or a variable name to access
the proper control sequence for the current printer. This allows
you to change print devices without recoding the printer-control
sequences for all the PUT CONTROL statements in
your application. For example:
|
In this procedure, the first PUT CONTROL statement turns
on compressed printing, and the second PUT CONTROL statement
turns off compressed printing for the current print device.