| DCMI - Creating an OUTQ for TCP/IP Printing |
There are at least a couple of different ways to print using LPR from the iSeries/AS400. One of them is the Send TCP Spooled File (SNDTCPSPLF) command. This command is somewhat inconvenient, however, because you have to type in the spooled file identification information. Using this command, there is no way to browse a spooled file and send it to an LPD system.
A more convenient alternative is to create an OUTQ to automatically print to your TCP/IP printer. This is a fairly straightforward process, detailed in the steps below. However, if you want your users to be able to assign output to a printer when they are using the *BASIC assistance level, you have to fake the iSeries into using the remote OUTQ. This process is also detailed in the steps below.
1. To create an OUTQ that uses LPR to print through TCP/IP, follow these steps:
Create a remote OUTQ with the CRTOUTQ command. The command syntax is this:
crtoutq outq(QUSRSYS/TCPTEST) rmtsys(*INTNETADR)
rmtprtq('DeskJet') cnntype(*IP) desttype(*OTHER)
mfrtypndl(*HP560C) intnetadr('201.210.30.30')
Notice that the output queue is created in QUSRSYS. This is to help us trick the iSeries into allowing users to specify the printer when using the basic assistance level. See the steps below for more information. The RMTSYS parameter is set to *INTNETADR, which allows us to specify the IP address of the LPD printer queue. The RMT-PRTQ parameter tells the iSeries which LPD queue to use. I'm sending this to a Windows NT LPD setup, so the queue name has to match the actual name of the printer on the Windows NT system (not the share name). The DESTTYPE parameter of *OTHER tells the iSeries to run the HPT function and translate all output to the printer type specified by the MFRTYPMDL parameter. In this case, the target printer is an HP693C, and the HP560C is the closest thing to it on the list. The INTNETADR parameter contains the IP address of the NT machine.
2. Start the remote writer. The command syntax is as follows:
strrmtwtr outq(QUSRSYS/TCPTEST)
This will, of course, start the remote writer. Now, anything you send to this OUTQ will print on the DeskJet hanging off of the NT machine.
That's all there is to it if everyone in your organization uses the *INTERMEDIATE assistance level. Assigning output to a remote OUTQ using the *BASIC assistance level is not directly supported, but you can fool the iSeries into making it work. To do this, you create a virtual printer device with the same name as the OUTQ and never vary on it. The device description sits on out there, not doing anything other than fooling the iSeries. When output is assigned to the printer using the *BASIC assistance level, the iSeries sees the existing fake printer and uses the remote OUTQ in QUSRSYS with the same name. Pretty tricky, eh?
To do this, continue with the following step.
3. Create a virtual 3812 printer device with the Create Device Printer (CRTDEVPRT) command.
crtdevprt devd(TCPTEST) devcls(*VRT) type(3812) model(1) online(*NO) font(011)
Again, be sure that the DEVD parameter is the same name as your remote OUTQ. When you run the command, you'll be notified that the OUTQ already exists. This is exactly what we want.
That's it! Your new TCP/IP printer should now function nearly identically to its iSeries brethren.