Use Workstation Customizing Objects to Control Printing
Every once in a while, a printing problem creeps up on the iSeries that doesn't have an apparent solution. Workstation customizing objects often provide the key to solving these printer woes. If you have some printing issues that you think can't be resolved, or you don't know what workstation customizing objects do, this tip is for you.
First, let me throw out a printing issue I came across in which a workstation customizing object (or *WSCST) was used to provide the solution. On our office network, we have an IBM InfoPrint 1120 with two paper trays: a high-capacity tray filled with plain paper and the standard default tray, filled with letterhead. For windows printing, the printer defaults to the high-capacity tray with blank paper. For iSeries printing, the Drawer(1) parameter defaults to the tray with the letterhead!
So what is a *WSCST, and how can it help in this situation? A *WSCST is IBM's way of letting users have complete control over a printer's behavior. I like to think of *WSCSTs as a way to build a custom printer driver for the iSeries. The *WSCST object itself is built from a source member.
The *WSCST source member will contain the escape sequences (sometimes called "escape codes" or "hex codes") for every command the printer is capable of accepting. It will contain, for example, the commands to start or to stop printing in boldface type, to start and to end subscript, and to print portrait or landscape. Having this kind of control over the printer, the iSeries should be able to take advantage of just about any feature a printer has to offer. Here is a sample taken from a *WSCST source member:
:INITPRT DATA ='1B45'X. :RESETPRT DATA ='1B45'X. :STRBOLD DATA ='1B28733342'X. :ENDBOLD DATA ='1B28733042'X.
The text is easy enough to interpret. INITPRT stands for "initialize printer." When an iSeries wants to send the command to initialize the printer, it will send the hex code '1B45'X. Likewise, when the iSeries wants to send a command to tell a printer to print in boldface, it looks for the entry :STRBOLD ("start bold") and issues the hex code found therein ('1B28733342'X.). To turn bold off, it sends the hex codes specified under :EndBold.
By now, you're probably uneasily wondering (a) how do I find all of the escape codes for my printer? (b) where do I enter all of them? and (c) wouldn't it take an incredibly long time to do?
The answers are as follows: (a) The escape codes that a printer will accept are often found in the user manuals, although this isn't always the case: sometimes you may need to seek an additional reference for this information; (b) You enter all of the escape codes into a source member, then issue a command to create the *WSCST object from the source member; and (c) Yes, it would take a long time to enter all of this information.
Fortunately, you would rarely, if ever, have to build an entire workstation customizing object from the ground up. If the iSeries supports your particular printer model (as defined in the manufacturer type and model on the printer's device description), IBM has already created one. If you have a printer that's not in this list, you can use a printer from IBM's list that's closely related to your model. For example, the HP4000TN isn't on the list of supported printers in V5R1. However, the HP5 series is a cousin of the HP4000TN, so the HP5 model can be used as a base to start with.
Also note that most laser printers support Hewlett-Packard's Printer Control Language (PCL). If you're printing to a PCL printer that hasn't been defined by IBM, and you want to make some modifications to how it works, you can probably work with the *HP4 or *HP5 definition.
Let's look at the drawer problem I mentioned. How do you change the drawer configuration on the InfoPrint 1120 so that the iSeries will draw from the high-capacity paper tray (with white paper), rather than the default tray (with letterhead), so that it is compatible with our Windows network?
The first thing to do is retrieve a *WSCST object source member. Enter and prompt the RTVWSCST command. Enter *TRANSFORM for the device type, press F4 on the MFRTYPMDL parameter, and look for the InfoPrint 1120. Remember, if you're particular model isn't available, most of the time it's just as well to choose a printer that is closely related (such as a similar model InfoPrint or a generic one such as *HP5). The InfoPrint 1120 isn't available on a V5R1 system, so I used the Lexmark Optra T (*LEXOPTRAT). How did I know to use the Lexmark Optra T? An IBMer told me this is the recommended substitute. Before that, I used the *HP5 model and it worked fine.
Here's the RTVWSCST command in full:
RTVWSCST DEVTYPE(*TRANSFORM) MFRTYPMDL(*LEXOPTRAT) SRCMBR(INFPRT1120) SRCFILE(MIKE/QCLSRC) TEXT('InfoPrint 1120 - Modified Drawer Selection')
Edit the source member and locate the following lines:
:DWRSLT DRAWER=DRAWER1 DATA ='1B266C3148'X. :DWRSLT DRAWER=DRAWER2 DATA ='1B266C3448'X.
These entries tell the iSeries which codes to send to the printer for drawer selection. Since the iSeries was printing the opposite of the Windows network, I simply swapped the hex codes, as follows, so that drawers 1 and 2 would be reversed:
:DWRSLT DRAWER=DRAWER1 DATA ='1B266C3448'X. :DWRSLT DRAWER=DRAWER2 DATA ='1B266C3148'X.
Simply reversing the selection will change how the drawers are configured. Save the source member and exit.
Create a new workstation customizing object, based on the modified source member, by using the CRTWSCST command:
CRTWSCST WSCST(QGPL/INFPRT1120) SRCFILE(MIKE/QCLSRC)
You have to tell the printer device description to use the new *WSCST. But first you need to end the writer and vary off the printer so the device description can be changed (in this case, the printer device is called LANPRT):
ENDWTR LANPRT *IMMED VRYCFG CFGOBJ(LANPRT) CFGTYPE(*DEV) STATUS(*OFF)
Change the device description to use the modified workstation customizing object:
CHGDEVPRT DEVD(LANPRT) MFRTYPMDL(*WSCST) WSCST(QGPL/INFPRT1120)
Note that the device must be using the host print transform feature TRANSFORM(*YES) in order to be able to use a workstation customizing object for an ASCII printer.
Vary the printer back on and start the print writer:
VRYCFG CFGOBJ(LANPRT) CFGTYPE(*DEV) STATUS(*ON) STRPRTWTR DEV(LANPRT)
The drawers are now reversed. Drawer 1 (the default) is now pointing to the high-capacity tray, and drawer 2 will print on letterhead.
For more information on workstation customizing objects, see the Workstation Customization Programming guide (in PDF format). For more information on common PCL commands, see HP's basic PCL commands.
It would be nice if every printer manufacturer included a workstation customizing object with every printer that was similar to the way that they package Windows print drivers. But with a little effort on the part of iSeries programmers and administrators, a workstation customizing object can be created to take advantage of special characteristics for any printer that can be attached to the iSeries.
Michael Sansoterra is a programmer/analyst for SilverLake Resources, an IT services firm based in Grand Rapids, Michigan. E-mail: firstname.lastname@example.org
Contact the Editors
|Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.|