Previous Topic Next topic Print topic


The terminal is perhaps the most important and complex device that a typical COBOL program uses. It can be used in two ways:

For unformatted screen I/O, the COBOL system takes no special action. It simply uses the logical UNIX devices stdin, stdout and stderr (see the chapter Device Handling in your Program Development Guide) assuming that these are redirected by the operating system from or to the terminal.

For formatted screen I/O, the COBOL system has to take action at two levels: the logical level and the physical level. The Adis module translates the high-level COBOL requirements into logical, low-level, terminal-independent operations. The screen handling module translates these logical operations into the terminal-dependent physical character strings and escape sequences required by the attached terminal. The screen handling module also translates any response from the terminal into logical form and returns it to the Adis module.

To carry out the mapping between logical and physical form, the screen handling module needs to know the type of terminal that is attached, the capabilities of that terminal type and the physical format of any I/O activity. UNIX provides a standard method for providing this information; the environment variable TERM contains the name of the terminal type, and the details for that terminal type are held in a UNIX system database, known as terminfo.

Previous Topic Next topic Print topic