Field attributes

From The x3270 Wiki

Overview

Every position in the 3270 screen buffer has one or more attributes. In the output from the ReadBuffer() action, these attributes have the following format.

attribute=value
attribute
A 2-digit hexadecimal number defining an attribute type.
value
A 2-digit hexadecimal number giving the attribute value.

Attribute types

Attribute type Attribute name
c0 Basic 3270 field attributes
41 Highlighting
42 Foreground color
43 Character set
45 Background color
fe Input control

Attribute values

Basic 3270 field attributes

Field attributes are an 8-bit field.

Bit Mask Meaning
8 0x80 Always set
7 0x40 Always set
6 0x20 Protected
5 0x10 Numeric
4 0x08 Intensity (high bit)
3 0x04 Intensity (low bit)
2 0x02 Always clear
1 0x01 Modified

Intensity

Bit 4 Bit 3 Mask Meaning
0 0 0x00 Normal, not light-pen detectable
0 1 0x04 Normal, light-pen detectable
1 0 0x08 Intensified, light-pen detectable
1 1 0x0c Non-display, not light-pen detectable

Highlighting

Value Meaning
00 Default
f0 Normal
f1 Blink
f2 Reverse
f4 Underscore
f8 Intensify

Colors

Value Color
00 Default
f0 Neutral/black
f1 Blue
f2 Red
f3 Pink
f4 Green
f5 Turquoise
f6 Yellow
f7 Neutral/white
f8 Black
f9 Deep blue
fa Orange
fb Purple
fc Pale green
fd Pale turquoise
fe Gray
ff White

Neutral/black represents the default background color. It displays as black on a white-on-black display, and white on a black-on-white display and on a printer.

Neutral/white represents the default foreground color. It displays as white on a white-on-black display, and black on a black-on-white display and on a printer.

Character set

Value Meaning
00 Default host code page
f1 APL (code page 310)
f2 xterm line drawing
f8 DBCS

Input control

Value Meaning
00 Input control disabled
01 Input control enabled

How to determine the attributes for a buffer position

Figuring out the attributes for a buffer position follows a three simple rules.

  • The attributes of a Start Field character affect all of the buffer positions to the right of the Start Field, until another Start Field is encountered. "To the right" includes wrapping from one line to the next and from the bottom of the screen back up to the top.
  • A buffer position with additional field attributes (SA) overrides the Start Field attributes, and affects all of the buffer positions to the right, until another buffer position with additional field attributes overrides it. "To the right" is as described above.
  • Additional attributes are cumulative, so if (for example) buffer position 27 has an additional attribute for foreground color and buffer position 28 has an additional attribute for background color, then buffer position 28 should be rendered with both position 27's specified foreground and its own background color. Buffer position 29 should also be rendered with both position 27's foreground and 28's background (unless it has its own additional attributes or is a Start Field).