Problem:
How can I change TERMCAP and TERMINFO entries to work with my program?
Resolution:
Terminal Interfaces
The RM/COBOL runtime system uses two terminal interface mechanisms, TERMCAP and TERMINFO, to control cursor positioning, video display attributes, and function key mapping. TERMCAP and TERMINFO databases are supplied by the operating system manufacturer. However, these databases may not contain complete entries for the terminal you are using, and as a result, certain capabilities used by the RM/COBOL runtime will not operate properly.
The RM/COBOL User's Guide documents the TERMCAP and TERMINFO capabilities used by the RM/COBOL runtime. This page includes sample TERMCAP and TERMINFO entries for some of the more popular terminals. (See below.)
These sample entries are provided for your convenience as examples only. Liant assumes no responsibility for the accuracy or completeness of these sample entries. Although the Support staff can assist you with general questions regarding TERMCAP or TERMINFO, they are not responsible for providing you working TERMCAP or TERMINFO entries, since this is an operating system related function.
Both the TERMCAP and TERMINFO versions of the RM/COBOL runtime system are present on the distribution media. During the installation process, you will be asked which version to install. The librmterm.so file determines whether termcap or terminfo is used by runcobol.
To switch from termcap to terminfo, change to the RM/COBOL installation directory and copy the librmti.so file to the librmterm.so file. For example:
cd /usr/rmcobol
cp librmti.so librmterm.so
To switch back, copy librmtc.so to librmterm.so.
For more information regarding TERMCAP and TERMINFO, we suggest the following Nutshell handbook: termcap & terminfo by O'Reilly & Associates, Inc. The ISBN is 0-937175-22-6.
Modifying TERMINFO Entries
The first step is to move the TERMINFO terminal source code into a file and subdirectory for testing purposes. For most systems the source code can be found in the subdirectory called /usr/lib/terminfo/. Check the man page of TERMINFO to find the location on your system. If available, the system command "infocmp" or "untic" can be used to create the terminal emulation source file. For example:
infocmp ansi > file.dat
will copy the source code for the ansi terminal definition into a file called file.dat.
The infocmp command may be slightly different on each UNIX system. Always check the man pages on your OS first. If infocmp is not available, check for the untic command.
To avoid destroying the system's TERMINFO files while testing, it is important to use a test database by setting a TERMINFO environment variable. With Bourne derived shells, for example:
TERMINFO=/usr/mydir/terminfo ; export TERMINFO
With C derived shells, for example:
setenv TERMINFO /usr/mydir/terminfo
Setting this environment variable causes the shell to look for a subdirectory of /usr/mydir/terminfo for terminal emulation definitions.
Once a terminal source code file is available, you can edit or add the TERMINFO key entries. The most commonly affected keywords are the following:
kf1 function key 1
kf2 function key 2
.
.
.
kf16 function key 16
box1/batt1 line draw for AIX
acsc line draw for UNIX
sgr/sgr0 terminal attributes
Next, compile the edited source code using tic. For example:
tic file.dat
The tic command places the compiled output into a subdirectory of the directory defined by the TERMINFO environment variable. It names the subdirectory by using the first letter of the definition in the source file. With TERMINFO set as described above, the compiled output of our example would be placed in the subdirectory /usr/mydir/terminfo/a (for ansi).
After the compilation is complete, set the TERM environment variable to the new definition and test. With Bourne derived shells, for example:
TERM=ansi ; export TERM
With C derived shells, for example:
setenv TERM ansi
In order to have the RM/COBOL runtime always use the newly created TERMINFO entry, change the account login script to include the environmental variables that point to the new entry (TERMINFO and TERM).
Zip file attached includes:
* Sample TERMCAP and TERMINFO Entries
terminfo.unx
terminfo.aix
termcap.rmc
* Sample RM/COBOL Runtime Configuration Files:
terminfo.cfg
termcap.cfg




