MC Press Online

Saturday, May 27th

Last updateThu, 25 May 2017 10am

You are here: Home ARTICLES Analytics & Cognitive Document Management AS/400 TCP/IP Printing to Windows Clients

AS/400 TCP/IP Printing to Windows Clients

Support MC Press - Visit Our Sponsors


Flexible Input, Dazzling Output with IBM i



Click for this Month's

Bookstore Special Deals

The PC5250 Terminal Emulation program that comes with Client Access is a pretty full-featured product, but it does have its faults. Looming largest on the list is the lack of printer emulation for TCP/IP connections. That’s right— whether you’re accessing an AS/400 remotely across the Internet or from just down the hall using Ethernet and TCP/IP, the PC5250 terminal emulator provides no printer support. (Oh sure, you can screen dump to your printer, but that’s about it.) To make matters worse, there’s not much documentation that will tell you how to solve the problem.

This article will map out the difficulties with TCP/IP printer support and help you build a solution that will work with your Client Access users. At first sight, this solution may seem a bit untraditional. However, as you’re working through the article, you’ll find that the potential for AS/400 TCP/IP line printing can have some surprising benefits.


TCP/IP Line Printing: The Good, the Bad, the Ugly


In an SNA environment, the PC5250 terminal and printer emulation programs establish ongoing sessions with the AS/400. SNA is a naturally robust environment for printer emulation, because the state of the printer can be monitored by the AS/400, and print jobs can be managed with the Work with Writer (WRKWTR) and Work with Spool File (WRKSPLF) screens.

In TCP/IP, however, connection to a remote device is essentially “stateless”; controlling information about the device is not shared with the host. For a program performing printer emulation, this means that there is no mechanism for returning messages to the AS/400 about the printing process. What’s needed, therefore, is a separate program to control this process. Line Printer Daemon (LPD) is exactly such an application- level protocol used for remote printing; its primary use is to receive print data sent from

another host. The LPD runs on the computer that is connected remotely to the AS/400 across TCP/IP. It receives the entire spooled file from the host, places the spooled file in its own queue, and then controls the printing process locally.

There are quite a number of third-party LPD programs available for PCs running Windows TCP/IP. This includes NetManage’s Chameleon, which comes with a hefty price tag, and many others. There are also shareware LPD products that are free for evaluation and require only a moderate registration fee. The product I’m using in this article is called Remote Print Manager (RPM) from Brooks Internet Software. It’s readily available as a demo on the Web, and costs only $40 to register. A quick search on the Internet for the term LPD will provide you with a long list of other potential Line Printer Daemon programs, with various levels of features and support. Some are even free.


Setting up a Line Printer Daemon


The Brooks RPM program comes in a *.ZIP file off the Web and needs to be extracted into its own directory. Once uncompressed, the setup program asks you to name a subdirectory that will hold the printing queues. This will be the area on the local PC disk where the AS/400 spooled file will be transferred to. You can establish several printing queue subdirectories; I chose to create one called MCEDITQ to hold the output from spooled files created on my AS/400, which is called MCEDIT.

RPM maintains three different types of spooled queues: a text/font queue for handling intelligent font-based printer spooled files, a raw printer data queue for directly processing raw print data, and a filter queue that uses an external file to format the received spooled file. Since we’ll be receiving preformatted spooled files from the AS/400, we’ll select the raw printer data type of queue (see Figure 1). Once set up, the LPD simply waits in stateless anticipation for some action.




Now we need to send a spooled file across the TCP/IP network. This is done with the OS/400 command Send TCP Spooled File (SNDTCPSPLF). SNDTCPSPLF uses the TCP/IP Line Printer Requester (LPR) function of the OS/400. To do this, the command needs to know the remote system’s name, the remote printer queue name, and the identification of the AS/400 spooled file.

Go to the AS/400 terminal session of Client Access and sign on as you normally would. Now, to find the spooled file information, type in Work with Spooled File (WRKSPLF) and press Enter. This gives you the basic display of spooled files that you have created on the AS/400. Now press F11 to view the various parameters associated with the spooled file (see Figure 2). Jot down the spooled file name, the spooled file number, the job name, the user name, and the job number. You’ll need these in a moment.

Now key in SNDTCPSPLF and press F4 (see Figure 3). Set the Remote system parameter to *INTNETADR. By keying *INTNETADR, you save yourself from the need to know the remote system’s DNS because you’ll be using the exact TPC/IP address of the PC instead. In the Printer queue parameter, key in the name of the queue that you’ve created on your PC. In our example, I’ve used MCEDITQ. For the spooled file entry, you must be able to provide the exact name, number, and job that uniquely identifies the spooled file on the AS/400. (This is the information you just jotted down in the step mentioned previously.) For Destination type, key in *OTHER to tell the command to send to a non-AS/400 machine.

Since we’re sending this spooled file to a system that doesn’t support SNA Character Stream (SCS) printers, you need to also key in *YES for the Transform SCS to

ASCII parameter. This will enable an EBCDIC-to-ASCII translation and activate specific control codes defined below in the Manufacturer type and model parameter. Of course, not every possible ASCII printer can be represented in the control code translation. However, choosing *IBM42022 will provide a pretty generic translation to an IBM letter-quality, dot- matrix-style printer. Most PC printers will also handle these codes. If want to peruse the list of possible printer drivers, you can press F4 at this prompt.

Finally, in the Internet address parameter, key in the exact Internet address of the remote PC. When you press the Enter key, the SNDTCPSPLF command will start the process of sending the spooled file across the Internet to your LPD on the PC.


The Line Printer Daemon


The RPM LPD functions very much like the AS/400 spooler. On the Windows machine, it acts as a go-between from the AS/400 spooler to the Windows Print Manager. It receives the entire spooled file from the AS/400 (see Figure 4 ) and then connects to the Windows Print Manager to output the file. Afterwards, the transferred spooled file is purged off the LPD’s print queue.

There are some drawbacks, however. Since the LPD is receiving raw printer data, it will not automatically print wide reports in landscape mode. This is something that has to be handled through Windows’ default setup of the printer. Also, because the data is translated from the SCS printer data stream to an ASCII data stream, there will be a loss of SCS formatting, such as bold and italic. Finally, the AFP data stream isn’t supported at all, so images sent from the AS/400 will not be transferable.

When it comes to the actual printing of the spooled files, error recovery is also pretty sparse using LPD. All control is passed over to the print manager, which, in Windows, is not very forgiving when it comes to restarting a spooled file. However, the actual monitoring of the transfer between AS/400 and PC is well covered. If for some reason the SNDTCPSPLF command fails, you can review the messages on the AS/400, or, with RPM, you can look at a log file that holds status messages for each spooled file transfer. Usually, the types of errors you receive will be associated with an incorrect spooled file name or number.

Note that if SNDTCPSPLF fails in its transfer, it will leave a TCP/IP session open with the LPD and a file open on the PC. This means the transfer process was begun but did not complete successfully. Because TCP/IP is stateless, all the LPD knows is that a request was issued from the AS/400. So it waits. It will wait forever if you don’t tell it to stop. To tell it, you close these aborted sessions in RPM by simply selecting them and deleting them from the queue.


Extending the Uses of LPD


Since LPD extends the basic TCP/IP connectivity beyond the basic support of Client Access/400, it creates a whole slew of potential printing applications that don’t require CA/400 at all. For instance, one can imagine a remote salesperson who never needs to sign on to the AS/400 but who must receive daily or monthly reports. After setting up a Line Printer Daemon on his computer, you can write an AS/400 CL program to automatically send him the report across the Internet at regular intervals. All the AS/400 needs is the salesperson’s Internet address and the name of the queue into which the spooled file is to be transferred. Using a Line Printer Daemon such as RPM can transform any Windows PC printer in the network into an extension of AS/400 spooling. I’m certain other possibilities for this inexpensive printer connection will soon become quite appealing. I think you’ll find that the same qualities that make TCP/IP so robust, stateless, and cost-

effective will inspire you to use a Line Printer Daemon in some very unique and creative ways.

If you want to try out Brooks Internet Software’s demo of Report Printer Manager Line Printer Daemon, you can find it at

Search the Web for other Line Printer Daemons for Windows; you’ll soon discover how powerful TCP/IP tools can increase the function of your AS/400’s support.

Figure 1: Selecting LPD Printer Queue Type


AS-_400_TCP-_IP_Printing_to_Windows_Clients04-00.jpg 450x480



AS-_400_TCP-_IP_Printing_to_Windows_Clients05-00.jpg 450x348


Figure 2: Spool File Selection Figure 3: SNDTCPSPLF Command8


AS-_400_TCP-_IP_Printing_to_Windows_Clients05-01.jpg 450x348



AS-_400_TCP-_IP_Printing_to_Windows_Clients06-00.jpg 450x284


Figure 4: RPM Spool Queue

Thomas Stockwell

Thomas M. Stockwell is an independent IT analyst and writer. He is the former Editor in Chief of MC Press Online and Midrange Computing magazine and has over 20 years of experience as a programmer, systems engineer, IT director, industry analyst, author, speaker, consultant, and editor.  


Tom works from his home in the Napa Valley in California. He can be reached at