3270 screen sizes¶
A 3270 has two screens:
- The default screen. Erase/Write writes to it. On models 2 to 5 it is 24 rows and 80 columns.
- The alternate screen. Erase/Write Alternate writes to it. It can be larger than the default screen.
The library finds the sizes of the two screens during the telnet
negotiation. Terminal.Size() gives the alternate screen.
tn3270.DevInfo.DefaultSize() gives the default screen.
The models¶
| Model | Terminal types (examples) | Default screen | Alternate screen |
|---|---|---|---|
| 1 | IBM-3277-1 |
12x40 | 12x40 |
| 1 | IBM-3278-1, IBM-3279-1 |
12x80 | 12x80 |
| 2 | IBM-3278-2, IBM-3278-2-E, IBM-3279-2-E |
24x80 | 24x80 |
| 3 | IBM-3278-3, IBM-3278-3-E, IBM-3279-3-E |
24x80 | 32x80 |
| 4 | IBM-3278-4, IBM-3278-4-E, IBM-3279-4-E |
24x80 | 43x80 |
| 5 | IBM-3278-5, IBM-3278-5-E, IBM-3279-5-E |
24x80 | 27x132 |
| none | IBM-DYNAMIC |
from the query replies | from the query replies |
The sizes are rows x columns. "-E" in a terminal type tells that the
terminal has the extended data stream (colors and highlight). It does not
change the size. tn3270.ModelOf(ttype) gives the model number.
tn3270.ModelSizes(ttype) gives the sizes of the model.
How the library finds the sizes¶
The library sends Erase/Write Alternate and a Read Partition Query. Then it uses the first of these sources that it has:
- The Implicit Partition query reply (QCODE 0xA6). It gives the default size and the alternate size.
- The Usable Area query reply (QCODE 0x81). It gives the alternate size. The default size is then the size of the model (24x80 if the terminal type has no model), but not larger than the alternate size.
- The model number in the terminal type.
- 24x80.
The sizes from the client are more correct than the model number. For
example, an emulator with the type IBM-DYNAMIC and a 40x100 screen gets
an alternate screen of 40x100. A client that does not send query replies
in 3 seconds gets the sizes of its model.
A screen must fit in 14-bit buffer addresses (16383 cells). The library removes rows from a larger screen until it fits.
Write to the default screen or the alternate screen¶
By default, ShowScreenOpts writes to the alternate screen. If the
alternate screen is the same size as the default screen (for example on a
model 2), it sends Erase/Write. Otherwise it sends Erase/Write Alternate.
Set ScreenOpts.DefaultScreen to write to the default screen with
Erase/Write. Use this for screens that you made for 24x80, when the
terminal is larger. ibmterm.ScreenSize(opts) gives the size of the screen
that ShowScreenOpts writes to with opts. Put the fields in that screen.
opts := ibmterm.ScreenOpts{Terminal: dev, DefaultScreen: true}
rows, cols := ibmterm.ScreenSize(opts) // 24, 80 on models 2 to 5
A 5250 also has ScreenOpts.DefaultScreen: its default screen is 24x80
(Clear Unit), and its alternate screen is 27x132 (Clear Unit Alternate).
NoClear and the Clear key¶
With ScreenOpts.NoClear, the library sends a Write and does not erase the
screen. But the library erases the screen in these conditions:
- The screen size changes. For example, the last screen was on the
alternate screen, and this screen has
DefaultScreen. - The operator pushed the Clear key after the last screen. The Clear key erases the screen, and on a real 3270 it also changes the terminal to the default screen. Thus the addresses of a plain Write can be incorrect.
Tests without a client¶
tn3270.NewDevInfo(ttype) makes a DevInfo with the sizes of the model in
ttype, without a telnet negotiation.