23
Sat, Nov
1 New Articles

The Linux Letter: iSeries and Linux Connectivity

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

As I write this, spring is in the air. The days are getting longer. The birds and the bees are busy building nests. The signs of renewing life are everywhere. In this hormone- and pheromone-laden environment, a techie's attention naturally turns to...connecting to the iSeries database from his or her Linux box.

No man is an island, as the saying goes, and nowhere is this truism more applicable than to operating systems. Those operating systems that were designed to be islands are no longer with us. Those whose designers took a more enlightened view of the world are now thriving. So it is with our beloved iSeries. IBM has been continually opening up OS/400 since V3R7 (or thereabouts). And the current version, V5R1 offers up storage and data to other operating systems in quite a few ways.

In this article, I'll give an overview of the more prevalent and convenient means of accessing iSeries data from my favorite non-iSeries operating system: Linux. Future articles will cover the nuts and bolts of configuring and using these access options.

Emulation, Storage, or Data?

When someone asks me about the connectivity options between OS/400 and Linux, I usually have to prompt him to specify which connectivity, since I distinguish three separate categories. First, there is 5250 emulation, which I'll only make mention of now, since I've discussed that in my last two columns. Second, there is storage access. This category refers to the use of an iSeries machine as a network storage server (NSS). In this scenario, the iSeries provides space in its pricey hard drive real estate for network clients (such as Linux and Windows PCs) to store files. Finally, there is the access of the iSeries database from programs running on other machines. Let's review the latter two options.

The iSeries as a Network Storage Server

There are benefits to using the iSeries as an NSS. It certainly eases the backup/restore management burden of critical PC files if they reside on the iSeries, since they can be backed up along with any of the regular files stored within the Integrated File System (IFS). Furthermore, the iSeries' well-deserved reputation for availability and bullet-proof hardware (recent hard drive failures excepted) provides a compelling combination for the PC administrator looking for a reliable server.

There are a few disadvantages that you must take into account before committing the iSeries to NSS duty, however. By IBM's own admission, the iSeries NetServer is not designed to be a file server for a huge Windows network. In this case, size does matter! For my small office (about 30 users), NetServer functions well and I'm pleased. I've seen varying reports in the Usenet groups--to paraphrase, "He said that she said that IBM said to keep your user count less than 50 or so." In short, your mileage will vary by the number of processors, disk arms, and other iSeries minutiae that affect performance.

A bigger impediment to your plans might be the cost of iSeries disk space. If you have users who are prone to saving the recipes, jokes, and images they receive from the internet into their shared drive space, then you have the computer equivalent of building a "U-Store-It" locker in the middle of downtown Manhattan. Clearly, it would not be a good investment. A well-defined acceptable-use policy can help you in this department.

FTP

When I decided that using the iSeries as an NSS made sense for me, I was pleased to find that it could do so for my Linux clients as easily as it does for my Windows clients. To start off with, OS/400 provides an FTP server that can be used from any client equipped with FTP client software (which includes virtually all common operating systems in use today).

Setting up the server on the iSeries is done via the iSeries Operations Navigator. Select Network->Servers->TCP/IP, and then right-click the icon for the FTP server properties. Once you have dismissed the set-up dialog, start the server by once again right-clicking on the FTP Server icon; then click on "Start." Once the iSeries has fired up the requisite programs, you connect to it by first issuing the command ftp youras400, then entering the required user ID and password. Once you've successfully logged on, you'll be greeted with the prompt "ftp>." If you're new to FTP, issuing the command help will provide you with a list of available commands. I won't write a treatise on FTP, since you can read the man page on your Linux machine for further information (man ftp). You also will want to read about FTP on the iSeries in the IBM documentation to learn about the slight differences in navigating FTP on an iSeries versus a Unix/Linux or Windows box.

RSYNC

Another option for transferring data files between the iSeries and Linux is available to those who have spent the hundred bucks (or so) to buy and install V4R5 5769-SS1 Option 33 OS/400 Private Address Space Environment, also known as PASE. PASE gives you the ability to run binaries that were compiled for AIX (IBM's version of Unix). The particular package that I find useful is an open-source project called rsync. This utility is designed to allow you to synchronize files between two or more computers (or two different directories on the same computer). I've found it useful for doing various tasks, such as backing up my laptop computer to my desktop system. I've even used it for keeping two servers mirrored, making one a hot spare for the other. If you venture to rsync's site, you'll find a pre-compiled version that you can download to your PC. I'll delve into the finer points of installing rsync and other AIX binaries in a future column. (For those wanting to work ahead, please note that you need to run rsync with the "-daemon" switch on the iSeries.)

NFS

Although Windows made peer-to-peer networking popular, it certainly doesn't have a monopoly on file sharing. IBM has seen fit to add to the OS/400 TCP/IP suite the Network File System, also known as NFS. The NFS server permits you to mount an iSeries directory (known as an "export" in the Unix/Linux world and a "network share" in the Microsoft world) onto a mount point on the Linux machine. The result is that the iSeries directory appears to be a directory local to your Linux machine, much like a Windows network shared folder appears as a drive letter on your Windows box. To mount an iSeries export from Linux, you need to configure and start the NFS server on the iSeries. As with FTP, you can accomplish this via the iSeries Operations Navigator; but you also can configure NFS using more traditional green-screen applications. For further information, I suggest that you read the Redbook Exploring NFS on AS/400 (SG24-2158-00), which you can find at IBM's Redbook Web site. Pay particular attention to "Chapter 4: NFS Security," since you'll need to learn about user IDs (UIDs) and group IDs (GIDs).

Those working ahead will want to note that making the UID on your iSeries user profile (via CRTUSRPRF or CHGUSRPRF) match that of your user profile on your Linux machine will make your NFS experience more pleasant. You can find your Linux UID by issuing the command grep "YourLinuxUserName" /etc/passwd . The UID will be found in the third field of the line. (Fields are separated with the colon character).

Although I have been writing this as though you would always want to transfer files to/from your Linux machine to the iSeries from the Linux side, you can perform the transfers from the iSeries side of the equation. I use this scenario to have my nightly iSeries backup program mount shares on my various Linux servers. Once done, the program then copies various files from the Linux machines to its own IFS so that they can be saved to tape. Unfortunately, IBM won't allow you to back up files across the network via the SAV command (perhaps so as not to eat into its BMRS software?), so I must resort to the copy first. It's not elegant, but it does work. As with the iSeries, you must configure an FTP or NFS server on your Linux box prior to accessing it from the iSeries.

SMB

The final access method available for the Linux user is Server Message Block (SMB), the lingua franca of Microsoft networking. I saved this for last not because it's the best but because it's not available to everyone. As I mentioned in last month's article, writing software to a Microsoft API is like hitting a moving target. And in the case of the NetServer on OS/400 V4R5, IBM's shot was a little behind the target. The SMB protocol they implemented on this release was not the newer one implemented by the Samba team. Samba is the open-source project that implements SMB networking on Unix/Linux machines. The first time I attempted to mount a NetServer share on my Linux machine, I was completely stumped by the fact that the mount command successfully completed, but there were no files showing under the mounted directory. Arrgh! I tried everything (short of slaughtering a sheep and placing its entrails on the keyboard) but to no avail. From what I've read, IBM has corrected that problem on V5R1, but since every machine for which I have responsibility is at V4R5 or earlier, I have not been able to confirm that. (Perhaps one of the readers will drop me a note and let me know?) If the problem has indeed been fixed, then you'll be able to omit the NFS server on the iSeries and do everything through Netserver, which will be much more convenient from a management perspective. And you'll be able to avoid the UID/GID situation too.

The iSeries as a Data Server

Having looked at the iSeries as a network storage server, we now turn our attention to the iSeries as a database server. You might think that connecting a Linux-hosted program to the iSeries would require some serious voodoo. But thanks to IBM's warm embrace of standards, the task is rather straightforward and simple. Let's look at some of your options.

The One-Shot Query

Imagine that you have a database file (table) on your iSeries that contains information you would like to work with in a spreadsheet format--perhaps the StarOffice spreadsheet. The simplest method in this scenario is to extract the appropriate records (rows) using the iSeries query tool of choice (Query/400, Query Manager, etc.) and then save the results into another database file. From there, it's simple to use the CPYTOIMPF command to convert the newly-created file into a tab- or command-delimited file on the IFS (my preference being tab-delimited with no string identifier because it's easier to use); then, use FTP from your Linux machine to transfer that file to your PC.

To test this scenario, I created a subset of approximately 8,500 rows from one of my database tables. This tab-delimited file was then FTPed to my Linux laptop, and from four different Linux spreadsheet programs (KSpread, Gnumeric, StarOffice 5.2, and StarOffice 6.0), I was able to import the tab-delimited file with no trouble. In fact, if you give your downloaded file the extension "csv," StarOffice will recognize the file type and open the file directly, without your having to go through an import step.

In lieu of FTP, you can transfer the file via an NFS-mounted directory or with V5R1 via an SMB share. You need to take care, however, to ensure that you allow for the code page differences between Linux and OS/400. A transfer through FTP gets it right without any additional gyrations.

JDBC

If you've been doing any programming in Java, then you've seen this acronym before. For truly cross-platform database connectivity, nothing beats Java. The jt400.jar file that you use on your iSeries is the same file that you need on your Linux machine to connect your Java programs or servlets to the iSeries database. So, if you are doing any Java work on your Linux box, the decision is simple: Use JDBC.

But what if you aren't writing Java programs? What user-level programs are available? The most obvious example I can offer is StarOffice, in either the free Version 5.2 or the for-purchase Version 6.0 (about $80). StarOffice can use JDBC data sources in the same fashion that Microsoft's Office Suite uses ODBC data sources (which should come as no surprise, since the same company [Sun Systems] owns both StarOffice and Java). StarOffice is not the only example. There are any number of Java-based utilities available on SourceForge. A quick search of the site with the term "Java" returned pages of results. Given that many of them are report writers, it's a cinch that at least some can take advantage of a JDBC connection to the iSeries.

ODBC

This de facto data access standard is not foreign to Linux. The open-source unixODBC project provides an ODBC driver and data source management facility similar to the one provided in Microsoft Windows. In fact, if you are at all comfortable using the ODBC manager on Windows, then you'll have no problem with the ODBC Data Source Administrator on Linux. Many of the newer distributions, such as Red Hat Linux 7.3, include unixODBC as part of their default installation. If yours does not, simply visit the unixODBC Web site to obtain the software and installation instructions for your distribution.

Once you have unixODBC loaded on your computer, your next visit should be to IBM to pick up the ODBC driver and instructions for the iSeries database. After the driver has been downloaded, installed, and configured, you'll have the same functionality from your Linux machine as you do from your Windows machine. Whereas the JDBC drivers had a somewhat limited range of languages and programs that would be able to use ODBC, the driver has many more applications. Besides the aforementioned StarOffice, which can use ODBC data sources, we have many more computer languages. For example, if you are doing your Web application programming in PERL or PHP, you'll be able to access the iSeries database with ease via the ODBC driver.

Surprised?

I know that many people are put off from using Linux because they have become comfortable with what they currently use. Changing a familiar environment is always stressful, but as you've seen from this article, there's nothing mystical or even much different about using Linux for iSeries access (except that you won't need to reboot constantly).

In my next column, I'll cover the installation and configuration of JDBC and ODBC in more detail. Until then, I'd suggest the following IBM Redbooks for your reading pleasure: Porting Unix Applications Using AS/400 PASE (SG24-5970), Exploring NFS on AS/400 (SG24-2158), and the Redpiece Linux Integration with OS/400 (SG24-6551). These are available at the IBM Redbook Web site.

Barry Kline is a consultant living in central Pennsylvania. His interests include Linux integration, Java Web-based applications, and motorcycling--just not all three simultaneously. Barry can be reached at 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: