21
Thu, Nov
1 New Articles

AS/400 TCP/IP Printing to Windows Clients

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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.

 

The SNDTCPSPLF Command

 

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 http://www.brooksnet.com.

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 ITincendiary.com.

 

 

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: