23
Sat, Nov
1 New Articles

The Linux Letter: Open-Source Terminal Emulation

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

In my first Linux Letter column, I asked for topic suggestions--and did I ever get them!

Judging by the volume of responses I received (for which I am grateful), I gather that many of you are ready to take the plunge but are unsure of how to integrate Linux into the same network as your iSeries. In fact, the number one topic suggestion was that I describe connectivity between a Linux box and the iSeries. This theme varied--from questions about 5250 emulation to questions about iSeries database access. Since almost everyone with an iSeries has an occasional need for green-screen access, I'll begin the connectivity series by introducing you to a 5250 emulator that shows the power and beauty of the open-source model. As an added benefit, you'll learn how to install "tar ball" software (from source) on your machine and get a taste of the Concurrent Versioning System (CVS). (Tar balls are so named because of the tool used to create the file--Tar.)

For the purpose of this discussion, I'll make the following assumptions about your Linux system: 1) that you already have Linux installed and configured for TCP/IP; 2) that the Linux box and iSeries can communicate with each other (use the ping utility from either machine to verify this); 3) that the Linux machine has access to the Internet; and 4) that you installed the development tools on your Linux machine during installation. You'll need the GNU C compiler as well as automake, autoconf, libtool, and ncurses. Check your distribution's documentation to learn how to verify whether or not you have the tools installed. If you don't, that same documentation will provide instructions for their installation.

The emulator software that I'll be using for this column is called tn5250. This is a prime example of open source: programmer has a need for a *nix-based emulator (in this case, the programmer is Michael Madore); programmer starts the project and tosses it out on the Internet; other programmers pick it up and start contributing their own bits and pieces. The result is the collaborative effort that we're now discussing. The tn5250 software is not the only emulator available for Linux (a commercial, Java-based emulator is available from MochaSoft, and there are other platform-specific commercial products out there as well), but what I really like about tn5250 is the depth of the product and the fine people who actively contribute to the project and its mailing list (also available at the Source Forge URL listed below). The product is rock solid. I've used it daily for more than a year, and it has worked without a hitch.

If you check the tn5250 project site, you'll note that there are three methods for obtaining the software:

  1. Retrieve the stable source and compile it yourself.
  2. Retrieve the latest development source and compile it yourself.
  3. Retrieve binary (recompiled) versions for specific distributions and install them. Binaries are convenient for anyone not wishing to "roll his own." In this case, binaries are available for the Red Hat and Debian distributions. Both Red Hat's RPM program and Debian's apt-get program, which are used to install the binary packages, allow you to maintain a software inventory on your system in a manner functionally equivalent to the iSeries' GO SOFTWARE suite. Thus, selecting a binary is the most expedient way to get going, but it's not as much fun!


I use the development source because of a problem I had with a System/36 (I'm not kidding) passthrough session. The stable version choked on POP (you old-timers know what I'm talking about), but the development version had a fix that corrected the problem. Which version you choose is up to you. If you don't get a warm, fuzzy feeling from using development versions of software, then, by all means, get the stable version. If, however, you're more adventurous, retrieve the development version. Let's look at both choices.

It's time to get your hands dirty. First, open a terminal session (a Gnome terminal or a Konsole session), which should land you in your home directory. Create a directory into which you'll place your source code by issuing the following command:

mkdir tn5250


Then, change to the directory with

cd tn5250


Now, open another browser window and point it to the home of tn5250 (http://tn5250.sourceforge.net/).

Getting the Stable Source

Under the heading "Getting tn5250," you'll find a link for the tn5250 files list. If you're interested in the stable code, click on the link; you'll be taken to the page shown in Figure 1. Hold down your shift key (to indicate that you want to download the file) and click on the link for 0.16.3. Download the file (which will be named tn5250-0.16.3.tar.gz) into the directory you created earlier.

http://www.mcpressonline.com/articles/images/2002/terminal%20emulationV400.png

Figure 1: From this Web page, you can download the stable code for tn5250.


Now that the tar ball is on your drive, you need to extract the source. Tar is a program that, in function, is like PKZIP in that it acts as a file packager. However, the name really is a contraction for Tape ARchiver, indicating its original use. The ".tar" portion of the filename extension indicates that Tar was used to create the file, just as ".zip" is commonly used to indicate that a file was created by PKZIP or one of its clones. The ".gz" portion indicates that the contents within the tar ball were compressed using the gzip utility. Sometimes these two extensions are used in the shorthand form ".tgz." In either case, use the following command to extract the files:

tar -xzf tn5250-0.16.3.tar.gz 


Return to your terminal session and issue the Tar command now. If you're interested in what the switches (parameters) in this command mean, simply issue either of these commands:

man tar (to read the manual page)
or
tar --help (to obtain the condensed help)

Once you've untarred the tar ball, you should find in your directory (using ls) another directory called tn5250-0.16.3. Change to that directory (cd tn5250-0.16.3) and wait while I get the source code for those who like to straddle the bleeding edge.

Getting the Development Source

The tn5250 project, like most open-source projects, uses the CVS to manage its source. CVS has been used for years as a means to allow multiple developers to work on the same project simultaneously. Furthermore, it permits branching within one project, which allows the user to pick any version in the development tree. Among its many capabilities is that of anonymous access, whereby anyone can obtain the current or past version, even if they aren't otherwise authorized to post updates to the project.

The instructions for obtaining the development source are on the Web page under "Getting tn5250" and are included in the following instructions:

To check out tn5250 via anonymous CVS, enter the following commands. When asked for a password for "anonymous," just press Enter.

cvs -d:pserver:This email address is being protected from spambots. You need JavaScript enabled to view it.:/cvsroot/tn5250 login

cvs -z3 -d:pserver:This email address is being protected from spambots. You need JavaScript enabled to view it.:/cvsroot/tn5250 co tn5250


The first CVS command logs you onto the CVS server, and the second retrieves ("checks out" in CVS parlance) the latest version of the source. Once you've watched all of the files scroll past as the source is brought to your system, you should find in your current tn5250 directory another called tn5250. Change to that second tn5250 directory:

cd tn5250


Then, issue the following command:

./automake.sh


Unlike DOS or Windows, *nix doesn't put the current directory in its search path when executing binaries. So the leading ./ is used to tell the operating system that you want it to execute automake.sh, which is located in the current directory.

One other thing: during the execution of automake.sh, you may get the rather intimidating error message "configure.in: 7: required file `./ltconfig' not found." If so, simply reissue the ./automake.sh command.

Compiling the Source

At this point, the instructions for compiling and installing the software are identical for both versions. Begin by issuing the following command:

./configure

This command examines the environment upon which it is running and creates the Makefile (which is used by a program called make that will invoke the actual compilation--and more--for you). Start the compilation simply by typing make, and wait while the source files are compiled and linked to create the executables.

The final step requires that you be logged on as the root user, since the installation script will be placing the resulting binaries and documentation into system directories. Switch to the root user by typing su and then respond to the password prompt. Now, issue the following command:

make install

Once again, you'll be mesmerized as all that text goes scrolling by (which sure beats a dull status bar!). Return to your previous user id by typing exit. Now you're ready to test-drive the emulator.

Testing 1-2-3

Although you may wish to do some additional customization steps (as noted in the documentation included with the software), you can now invoke the emulator by issuing this command:

xt5250


When prompted, fill in the name of your iSeries and press Enter. You now should be looking at an emulator screen similar to Figure 2. If you are, congratulations! You've just installed your first program from source. In the unlikely event that it doesn't work as expected, keep reading. I'll discuss your help desk options shortly.

http://www.mcpressonline.com/articles/images/2002/terminal%20emulationV401.png

Figure 2: Voila! Here's your 5250 emulator screen!

Documentation? Yeah, We Have That!

To the user, one of the most important facets of a software package is documentation. Unfortunately, many open-source projects are somewhat lacking in this department. It isn't that there is no documentation. Rather, open-source projects rarely have a technical writer and graphic artist; hence, the lack of a polished manual in either printed or PDF form. But all is not lost. For the popular open-source software--such as Sendmail, Apache, or even the VI Editor--books are available from various publishers. But for the smaller projects or those with a limited audience (such as tn5250), the docs are typically limited to a man page (man tn5250) installed with the software, as well as two files that are worth taking your time to read: INSTALL and README. (Note: INSTALL may be omitted with a binary distribution.) The README file typically contains some of the basic information concerning the software, such as its purpose or its software prerequisites. You may use the less or more commands to view either of them, since they are just text files. Simply type less INSTALL (case important!) or less README to browse the information.

If you are having difficulties installing or using the software, use the Internet to your advantage. With this project, as with most others, you'll find listed somewhere in the documentation a mailing list devoted to the project. In the case of tn5250, a quick scan of the documentation from the README file shows the following information:

http://tn5250.sourceforge.net/ - linux5250 Homepage
http://www.midrange.com/linux5250.shtml - linux5250 List Info
http://archive.midrange.com/linux5250/index.htm - linux5250 List Archives
http://sourceforge.net/projects/tn5250/ - linux5250 at Sourceforge
http://perso.libertysurf.fr/plinux/tn5250-faq.html - linux5250 FAQ

Responses to help requests are typically swift and incisive.

Tweaking and Configuration

Although there are many options available to you (such as specifying the number of columns or instructing tn5250 to report to the iSeries that it is one of a number of different IBM terminal types), you can use just the default values successfully. If you read the docs, you'll note that you can store your choices in a configuration file or submit them as command line parameters when you invoke xt5250. I chose the latter and embedded them into a script that starts four 80-column instances of the emulator followed by one 132-column instance. This script is shown in Figure 3. I'm not going to cover how the script works in this month's column. If you're interested, type man bash and man tn5250 to follow it.

#!/bin/bash
# I regularly use my laptop at two different client locations, both
# with an iSeries.  It just so happens that the two sites use the same
# private Class C networks (192.168.1.0).  At one site I use SSL to 
# connect to the iSeries and at the other I just use clear text.

# Get the name of the machine on which this script is running.
SESSION=$(echo $HOSTNAME | cut -d. -f1)

# Find the AS/400.  Please note that this works only because the address
# used by the iSeries at one site is unused at the other, and vice versa.
# You'd want to use a host selection method more appropriate to your situation. 
for ip in 192.168.1.24 192.168.1.101; do
if ping -c 1 $ip>/dev/null; then
[ $ip = "192.168.1.24" ] && ip="+ssl_verify_server ssl_ca_file=/usr/local/etc/hunt400.pem ssl:$ip"
break
fi
done

# Connect to the machine that answered.
[ -z '$ip' ] && exit 1
echo "Connecting to $ip"

# Create four 80-column sessions
for s in 1 2 3 4; do
xt5250 $SESSION$s env.DEVNAME=$SESSION$s $ip &
sleep 2
done

# Create the 132 character session.
sleep 2
s=132
xt5250 $SESSION$s env.TERM=IBM-3477-FC env.DEVNAME=$SESSION$s $ip &

Figure 3: This simple script starts a total of five emulator sessions.

Be aware that Client Access Express connections use encryption when connecting to the iSeries so that the user ID and password are obscured before traveling over the network. This program, by default, does not. Thus, anyone with a packet sniffer could watch your communications. However, you can configure tn5250 to encrypt its communications, too. The instructions are in the file README.ssl. If you look back at Program 1, you'll note that I differentiate between the two systems because one is configured for encryption and one isn't, which changes the command line parameters used.

Go Forth and Emulate

There you have it--a nice 5250 emulator that not only is free but also doesn't encumber your Client Access user count. And it's a fine example of open source in action.

Most of the time, you'll use binary packages to add software to your Linux machine (assuming that you use a popular distribution which supports them). But when one isn't available for the software or distribution that has caught your eye, you'll be happy to know that nearly all tar ball programs are compiled and installed using the same steps used during the installation of this one: ./configure, make, and finally (as root) make install. What you've learned during the installation of tn5250 is applicable to much of the other software you'll compile. Just be sure to read the INSTALL file before you begin. And, in case you are curious, you can typically remove a program so installed by issuing the command make uninstall from within the directory where you originally ran make install. Clean-up is, therefore, relatively painless.

As always, I welcome your comments and suggestions. Feel free to send them to This email address is being protected from spambots. You need JavaScript enabled to view it..








Barry Kline 0

Barry L. Kline is a consultant and has been developing software on various DEC and IBM midrange platforms since the early 1980s. Barry discovered Linux back in the days when it was necessary to download diskette images and source code from the Internet. Since then, he has installed Linux on hundreds of machines, where it functions as servers and workstations in iSeries and Windows networks. He co-authored the book Understanding Web Hosting on Linux with Don Denoncourt. Barry can be reached at This email address is being protected from spambots. You need JavaScript enabled to view it.

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: