Wide Terminal Mode

This facility is for use with COBOL only, and enables you to use a wide mode if it is supported on your terminal; for example vt100 style terminals have a 132 column mode. All normal methods of screen output are allowed including ANSI DISPLAY, Adis DISPLAY and the cobprintf() call. Cursor addressing must be consistent with the current terminal mode. For example, if you ask Adis to position the cursor at column 100 while in 80 column mode, this is not successful, neither does it cause an automatic switch from normal to wide mode. Wide mode must be set explicitly as shown below.

To use this facility you must include a record in the Working-Storage Section of your program as follows:

01 mode-number pic x comp-x.

then at run time you use the following call:

call "cobtermmode" using mode-number

where mode-number can have one of the following values:

Value Meaning
0 Standard terminal mode. The standard terminal terminfo file is used.
1 Wide terminal mode. The standard terminal name suffixed by -w is the name of the terminfo file used.

The value of RETURN-CODE is set to zero if the call completes successfully. It is set to non-zero if the call fails, for example if the required terminfo file cannot be found. The method of searching for terminfo is described in Searching Portable and System Terminfo Databases.

If the call is successful, the screen handling system is initialized (if it was not already) and:

As the screen handling system is now initialized, all DISPLAY statements now use it, including ANSI DISPLAY statements.

If the call fails, the RETURN-CODE is nonzero and the screen does not change. The RETURN-CODE is set as follows:

Value Meaning
0 Operation successful.
1 The terminfo file has not been found, is not readable, is corrupt or there is not enough memory.
2 The terminfo file does not contain one or more of the required capabilities.
3 The environment does not support the requested code.

When using the cobtermmode call, you must be aware of the following:

To cause the terminal to switch states, six terminfo facilities are used:

Full Name Abbreviated Name
init_1string is1
init_2string is2
init_3string is3
reset_1string rs1
reset_2string rs2
reset_3string rs3

These are fully documented in the AT&T UNIX System V Interface Definition (SVID) and are used as follows:

Ensure that the terminal mode and terminfo specified by the terminal name in TERM match when you run an application.