Understanding and Exploiting Qshell on IBM i

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

Qshell's Unix-like interface to the iSeries is especially helpful for developing in Java and for working with the IFS.

 

Editor's Note: This article is an excerpt from the book Qshell for iSeries, which is available as an e-book from MC Press.

 

A shell is a program that allows a human to interact with an operating system in a conversational way. The QCMD program that runs on the IBM iSeries computer is a shell of sorts. DOS, the original operating system of the IBM PC, boots up to a shell called Command.com.

Unix and Linux Shells

Unix systems also have shell interfaces, but in the Unix world, there are several shells from which to choose. The Bourne shell, introduced in 1979, is the standard Unix shell, primarily used for system administration. It lacks many of the features of other, more recently developed shells, but is available on all Unix systems.

 

The C shell, which was developed at the University of California at Berkeley, is based on the C programming language. It is more powerful than the Bourne shell, and many programmers were quick to adopt it when it became available.

 

All other Unix shells are descendants of the Bourne and C shells. For example, David Korn developed the Korn shell in the mid-1980s as a superset of the Bourne shell. That is, the Korn shell is able to run scripts written for the Bourne shell, but the Bourne shell cannot run all scripts written for the Korn shell.

 

The invention of the Linux operating system brought about many new shells, but the two primary Linux shells are the Bourne-again shell (known as "bash"), based on the Bourne shell, and the TC shell, based on the C shell. These shells are now included with some Unix systems.

 

To facilitate the use of technology across platforms, two organizations have established standards for Unix shells. In 1986, the Institute of Electrical and Electronics Engineers (IEEE) released the Portable Operating System Interface (POSIX) standard for Unix systems. The POSIX standard is based on the Korn shell. The Open Group, a consortium of information-technology suppliers, created the X/Open standard as a superset of the POSIX standard. Qshell is based on both POSIX and X/Open standards.

Qshell

Qshell is a Unix-like interface to the IBM iSeries. It is a Bourne-like shell, with many features from the Korn shell. Qshell began as a port of the ash shell, a Bourne-like shell from Berkeley Software Design (BSD). After the porting team had dealt with iSeries-specific issues like translation between ASCII and EBCDIC, they began adding features from other Unix shells. When a feature was implemented differently in different shells, the team followed POSIX standards.

 

Qshell consists of a command-line interpreter and a collection of utilities. The interpreter may be run in either interactive or batch mode. In interactive mode, it looks similar to the QCMD interface to OS/400 (Figure 1.1).

 

050912_Qshell_Fig01-01

Figure 1.1: The interactive shell resembles the QCMD display. (Click images to enlarge.)

The Need for Qshell

OS/400 already has the QCMD interface, a menu-driven interface, and iSeries Navigator (previously known as Operations Navigator). You might wonder, then, why there is a need for the Qshell interface. The answer lies in its unique benefits:

  • Qshell includes commands that are not found in QCMD or iSeries Navigator, so it complements the other interfaces; it does not replace them.
  • Qshell is well-suited for working with the Integrated File System (the IFS), because the IFS is a hierarchical file system similar to those used on Unix systems.
  • Qshell can run shell scripts from Unix platforms with little or no modification, so programmers from Unix systems can do productive work on the iSeries.
  • Qshell handles multithreaded programming.
  • Qshell is a good environment for creating Java applications.

Installing Qshell

Qshell is a licensed-program product that ships with OS/400. However, it is not mandatory that you install Qshell for OS/400 to operate. To determine whether or not you have Qshell, use option 10 of the LICPGM menu. Look for an entry for the Qshell Interpreter, as shown in Figure 1.2. If the Qshell interpreter is not listed as an installed program, load the system installation media and use option 11 to install Qshell. Page through the list of licensed programs until you see product option 30 (OS/400-Qshell Interpreter). Type 1 in the Option column of the Qshell Interpreter line as shown in Figure 1.3, and press Enter.

 

The system will ask you to confirm that you wish to install Qshell. Press the Enter key. You will see the Install Options display, pictured in Figure 1.4.

050912_Qshell_Fig01-02

Figure 1.2: Verify the installed status of the Qshell Interpreter.

 

050912_Qshell_Fig01-03

Figure 1.3: Start the install of the Qshell Interpreter.

 

050912_Qshell_Fig01-04

Figure 1.4: Specify installation options on the Install Options display.

 

Ensure that your installation device is specified correctly, depending on which CD or DVD drive you're using. Specify option 1 to install both programs and languages. Rebooting your iSeries is not required when installing Qshell, so specify an automatic IPL option of N. Press Enter to start the installation, and the system will begin installing Qshell.

 

050912_Qshell_Fig01-05

Figure 1.5: Wait for the system to finish the installation of Qshell.

 

You will know you are finished when you get the confirmation message shown in Figure 1.6. The Qshell interpreter is now ready for use.

 

050912_Qshell_Fig01-06

Figure 1.6: Wait for the system to finish the installation of Qshell.

Summary

Qshell adds a Unix-like interface to the iSeries. It is especially helpful for developing in Java and for working with the IFS. Once you have verified that Qshell is installed, you are ready to run it, which is the subject of the next chapter.

 

Editor's Note: To learn more, order Qshell for iSeries. All e-books are priced 15% less than the lowest price for the printed version.

 

BLOG COMMENTS POWERED BY DISQUS