Sunday, June 27, 2010

Setting X3270 in Gentoo

A common way to access Mainframe is using a 3270 terminal emulator running on a PC. There are a lot of 3270 terminal emulators available for both Windows and Linux. x3270 is one such terminal emulator for Linux. The best thing is that it is open source and free as in "free beer". It is present in the official software repositories of major Linux distributions and can be easily installed.
To install it in Gentoo, emerge the package net-misc/suite3270.

emerge --verbose net-misc/suite3270

Unlike most other applications, it is a pure X application and therefore more work is needed to set it up correctly.
The most common error you will encounter at first run will be(If you run from terminal):

Warning: Cannot convert string "-*-helvetica-bold-r-normal--14-*-100-100-p-*-iso8859-1" to type FontStruct

And you will left with a very small application window. Please note that maximizing or resizing window will not work on x3270. If you try to increase the font size by going into Options --> Font, you will be greeted with one more error message.




Now click on the keyboard icon in the application window and you will land up with one more error message in the terminal.

Warning: Cannot convert string "-*-fixed-medium-r-semicondensed-*-12-*-*" to type FontStruct


As you can guess all the three error messages are related to Fonts. The first error message indicates that x3270 cannot find the helvetica 100 DPI font.
For Gentoo the above and other 100 DPI fonts can be installed by emerging the package media-fonts/font-adobe-100dpi

emerge --verbose media-fonts/font-adobe-100dpi

The second error Message indicates that the x3270 can't find the 3270 fonts that were installed with the package. A temporary and per session solution will be using xset to set the path correctly.

xset fp+ /usr/share/fonts/x3270/
xset fp rehash

You can check the current font paths searched by X server using

xset q

The output will be like:

Font Path:
built-ins,/usr/share/fonts/x3270/

Please note that font path shown above is for Gentoo and may differ per distribution. To permanently add x3270 fonts to X server font path, you will need to edit the xorg.conf file. The file will usually be present in /etc/X11/. Create the file if it doesn't exist already. For an existing file add the following line in the Files Section.

FontPath "/usr/share/fonts/x3270"

For a new file add the following section.

Section "Files"
FontPath "/usr/share/fonts/x3270"
EndSection

The third error message indicates that x3270 can't find the fixed-medium-r-semicondensed font of size * x 12.

In Gentoo you can install the above and various misc X fonts by emerging package media-fonts/font-misc-misc.

emerge --verbose media-fonts/font-misc-misc

After installing above fonts you have to restart your X server. This can be done by simply logging off and again logging on. Hopefully you will not find any other error messages related to fonts, if you do follow the same procedure as for x3270 fonts to add your installed fonts in X server font path.

I am always very lazy to read the documentation and therefore it took me one day to figure out how to copy and paste in x3270. Normal Ctrl-V does not work if you are pasting in a x3270 dialog box. You have to use middle mouse button to paste. x3270 automatically copies a text once you select it.

Reference: