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:
- A RETURN-CODE of zero is returned.
- Adis restarts in the new mode.
- All character and attribute maps are cleared.
- The screen is cleared and the cursor positioned in the home position.
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:
- The number of columns in wide mode must not exceed 255 .
- When running under Animator, this call causes the terminal to be initialized to the new mode, which can produce some flicker of the display. Switching between Animator and user screens causes mode changes as the wide terminal mode is not supported for Animator's screen.
- When the run-time system exits, the terminal is restored to normal mode. This applies only to mode changes made under the control of this call.
- Since the usual path-searching rules are used, if the directory pointed to by COBTERMINFO contains an entry for the terminal in normal mode, but not wide mode, but the system terminfo directory does contain an entry for that terminal in wide mode, the normal mode uses the COBTERMINFO version and wide mode uses the system version. This can cause unexpected results where the two files differ in capabilities other than column size changes.
- If you have already set the TERM environment variable to indicate that a wide mode is required (that is the TERM value already has a -w suffix), issuing the call to use wide mode results in a suffix of "-w-w". This almost certainly fails, unless the terminal has a double wide mode and a terminfo file for this mode is available.
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:
- When the screen libraries start up normally, is1, is2 and is3 are output in that order. When the terminal mode is changed, rs1, rs2, rs3 are output, then is1, is2, is3 of the new terminfo are output in that order.
- Standard terminfos can contain the column switching sequences in either the rsx family or the isx family, hence both need to be used. Terminfos that do not provide it in either need to be modified, or a new terminfo file needs to be supplied.
Ensure that the terminal mode and terminfo specified by the terminal name in TERM match when you run an application.