Configuring an IBM i for Emacs and Perl hacking

An “IBM i” is a descendant of the old AS/400 machines and has undergone numerous name changes over the years. Most code on it is written in a language called RPG, but which unfortunately lacks polyhedral dice altogether. When IBM decided to promote Java for the platform, they had to have a Unix like tool to manage everything, so they built one from scratch with local tools and languages. At the same time, IBM realized they could run the machine with more or less the exact same hardware as their AIX boxes, so a second stream of “Unix-ness” was introduced into the platform.

First you need to install Option 30 (QSHELL) and Option 33 (PASE) on your operating system. PASE is a bonafide AIX type Unix environment. QHSELL is a Unix-like environment that is implemented in native code/objects. You’ll use PASE to run ‘real’ Unix programs and you’ll use QSHELL when you need a tool that groks the differences between Unix and the local environment.

Next you want to go install The iSeries Tools for Developers (product 5799-PTL). This will give you version v5.8.7 of Perl and version 20.7.2 of Emacs relatively painlessly. You’ll want to set up symbolic links for at least these programs:

ln -s /QIBM/ProdData/DeveloperTools/pase/bin/perl /usr/bin/perl 
ln -s /QOpenSys/QIBM/ProdData/DeveloperTools/perl587/bin/perldoc /usr/bin/perldoc 
ln -s /QOpenSys/QIBM/ProdData/DeveloperTools/emacs/bin/emacs /usr/bin/emacs

Now you can call Perl and Emacs from the command line… except you can’t run Emacs, yet.

You’ll need cygwin installed on your Windows box. Pull down the xwindows libraries when you configure your setup. You’re good to go when you can type “startx” from a cywgin command line.

Go to C:\cygwin\usr\X11R6\bin and make a shortcut to startxwin.bat onto your desktop. Run this to go directly to x without having to start cygwin first. Once you’re at the x command line, type “xhost YOURSERVERNAME”.

Now start your 5250 emulator. At the command line, type STRQSH to go into QSHELL. Once there, enter the following commands:

system "strptl CLIENT('1.2.3.4:0.0')" 
export DISPLAY="1.2.3.4:0.0" 
emacs

If you don’t know what your ip address is to set up your DISPLAY environment variable there, you can just peek in the startxwin.bat to get it. You can also put the above commands into your .profile file so that they run every time you start QSHELL. Both your .emacs and .profile files go in the “home folder” that you start off in when you open QSHELL.

Enjoy!

About these ads

One Response to “Configuring an IBM i for Emacs and Perl hacking”

  1. Thierry Says:

    Thanks a lot, very useful tip. Can’t wait to test it out at work on my i5 box.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: