Three Ways to Direct OS/400 Output Queues to TCP/IP Printers
July 24, 2002 Timothy Prickett Morgan
In shops with TCP/IP networks, a common task is to redirect OS/400 printer output to a TCP/IP printer sitting somewhere else on your network. While the easiest way to configure the printer is by hard coding the IP address inside the printer output queue configuration, that’s not the only way to do it. In fact, there are three different ways to configure an OS/400 TCP/IP remote output queue that I’d like to share with you.
For this example, let’s look at sending output to a networked TCP/IP printer by using a remote writer that is started through an OS/400 remote output queue. [Note: The concepts I’m discussing here can also be applied to device-based IP printers configured by using the Create Device Description (Printer), CRTDEVPRT command, but I unfortunately don’t have the space to cover CRTDEVPRT TCP/IP configuration in this tip]. Let’s say we’re setting up an OS/400 remote output queue called HPLJ5SI in library QGPL. This new queue will be printing to the RAW remote printer queue of a TCP/IP-connected HP LaserJet 5SI, which has an IP address of 10.0.0.5. To create this output queue and direct it to that address, we would enter the Create Output Queue (CRTOUTQ) command as follows:
CRTOUTQ OUTQ(QGPL/HPLJ5SI) + RMTSYS(*INTNETADR) RMTPRTQ(RAW) + AUTOSTRWTR(1) CNNTYPE(*IP) + DESTTYPE(*OTHER) MFRTYPMDL(*HP5SI) + INTNETADR('10.0.0.5') + TEXT('HP 5SI Outq for Fifth Floor printer')
The Remote System (RMTSYS) value of *INTNETADR combined with the *IP Connection Type (CNNTYPE), a Destination Type of *OTHER (DESTTYPE), and the Internet Address (INTNETADR) of 10.0.0.5 specify that we’ll be redirecting queue output to a TCP/IP printer. The RAW value for the Remote Printer Queue (RMTPRTQ) parameter tells OS/400 to send spool files to the RAW printer queue on our target printer. The Writers to Autostart (AUTOSTRWTR) value of 1 tells OS/400 to automatically start one TCP/IP writer to be used by this remote output queue, and the rest of the parameters describe the print characteristics of the printer this queue will sending information to.
Once created, OS/400 will automatically start a remote writer associated with this output queue whenever TCP/IP starts or a change is made to this output queue. To end this writer, use the End Writer (ENDWTR) command, as follows:
If you wanted to restart the remote writer, use the Start Remote Writer (STRRMTWTR) command specifying the remote output queue, as follows:
Here’s the downside of hard coding IP addresses into printer output queues: If your destination printer has an IP address change, you have to search all the output queues on your system to find the queue (or queues) that redirect printouts to the old address. If you have multiple AS/400s with multiple TCP/IP-based output queues, locating the proper output queue can be fairly tedious when IP changes occur.
To slightly ease that burden, you could configure the remote output queue’s IP address by using an OS/400 host table entry for your RMTSYS value. You do this by entering a host table name that’s associated with your printer’s IP address and assigning the host name–not the IP address–to your printer queue. You can create the host table name by opening the Configure TCP/IP menu (GO CFGTCP) and selecting option 10, Work with host table entries. Then you would use option 1=Add on the Work with Host Table Entries screen to enter a new entry that associates your IP address with a unique host table name.
For our example, assume that we added a host name of FIFTH_FLOOR_HP5SI_PRINTER to our host table, and that name is assigned to IP address 10.0.0.5. Now, if we wanted to create our remote output queue to print to 10.0.0.5 via this host table entry, we would create the remote output queue with the following CRTOUTQ command:
CRTOUTQ OUTQ(QGPL/HPLJ5SI) + RMTSYS(FIFTH_FLOOR_HP5SI_PRINTER) + RMTPRTQ(RAW) AUTOSTRWTR(1) + CNNTYPE(*IP) DESTTYPE(*OTHER) + MFRTYPMDL(*HP5SI) + TEXT('HP 5SI Outq for Fifth Floor printer')
By doing this, we shifted the IP address resolution away from the remote output queue and into the OS/400 host table, where it can be used in multiple objects throughout the system. The remote output queue will now redirect printouts to the TCP/IP address specified in the FIFTH_FLOOR_HP5SI_PRINTER host table entry. If the printer changes its network IP address in the future, we would only have to change our host table entry and the printer would then be redirected to the new address through the FIFTH_FLOOR_HP5SI_PRINTER host name.
Conversely, if we wanted to change an existing printer queue to use the FIFTH_FLOOR_HP5SI_PRINTER host name, we could use the Change Output Queue (CHGOUTQ) command as follows:
CHGOUTQ OUTQ(QGPL/HPLJ5SI) + RMTSYS(FIFTH_FLOOR_HP5SI_PRINTER) + INTNETADR(' ')
This CHGOUTQ command leaves all the other parameters intact while wiping out the original IP address for the queue by blanking out the INTNETADR parameter; it also redirects printer output to the site designated by the FIFTH_FLOOR_HP5SI_PRINTER host table entry.
While using host table names in your printer output queue descriptions centralizes your IP addresses in one place, it still leaves you with the same problem you have when you hard code the address: If your printer changes IP addresses, you still have to manually change the remote TCP/IP printer’s IP address on your AS/400 (except the change is in the host table this time). To get around that issue, you could also use a DNS entry if one is available for your printer. In fact, using DNS entries inside OS/400 objects is a good practice because a single change to a DNS entry will automatically ripple throughout your network, allowing you to quickly make IP changes without having to incur a lot of manual maintenance. So if you assign a DNS entry for your target printer to your remote output queue, OS/400’s DNS function will do the work of looking up the IP address for you.
Assigning a DNS name to a printer output queue is functionally the same as using a host table name. So if your HP 5SI printer had an internal DNS name of hp5si.midrangeguru.com and a short DNS alias of HP5SI, you could have your remote output queue resolve that DNS name to an IP address by configuring your queue to point to the DNS alias, as follows:
CRTOUTQ OUTQ(QGPL/HPLJ5SI) + RMTSYS(HP5SI) RMTPRTQ(RAW) + AUTOSTRWTR(1) CNNTYPE(*IP) + DESTTYPE(*OTHER) + MFRTYPMDL(*HP5SI) + TEXT('HP 5SI Outq for Fifth Floor printer')
And if you have DNS lookup configured correctly on your AS/400, your remote output queue will resolve to the IP address of your networked HP 5SI printer. Here’s the upside: Using a DNS name for your remote output queue shifts the IP resolution work away from your AS/400 and on to the network. Here’s the downside: This technique may add a small amount of network traffic as OS/400 DNS communicates across your network to resolve the address.
So there you have it: Three techniques for setting up a remote output queue that resolves to a TCP/IP-attached printer on your network. And depending on how you want to get your work done, each of these techniques will work equally well.
On June 30, 2002,
On July 1, 2002,
We have the solution! CASS certify your mailing names and addresses and presort your outgoing mail and save. Our CASS certification software ensures that your address files have valid ZIP Code and address information. Our presort software ensures that you can properly prepare you mail for delivery to your Post Office.
WorksRight Software, Inc. is the number-one source for iSeries and AS/400 CASS, presort, ZIP Code, and area code software and data.
Visit our Web site – www.worksright.com – to learn more about our CASS and presorting software, or contact WorksRight Software, Inc., phone 601-856-8337,