5250 colors and display attributes

From Try-AS/400
Revision as of 15:26, 9 July 2025 by PoC (talk | contribs) (→‎Attribute to color mapping: more precise)
Jump to navigation Jump to search

The IBM 5250 data stream was devised in the 1970's. Color was not thought of, even if color displays were well known for a long time from TV. After the later introduction of color displays for computer terminal screens, already established display attributes were reused for indicating which color something on the screen should have.

Display attributes are encoded in a single, otherwise invisible screen position directly preceding the screen element(s) the attribute is applied to.[1] This attribute byte can be modified with the DDS keywords COLOR and DSPATR and indicators. Since indicators are limited in count, conditionally applying many attributes to many screen objects can quickly exhaust the number of available indicators for a given screen (record format).[2]

Attributes

The basic display attributes are specified as follows. Counted from right to left (LSB to MSB)!

Bit Attribute (DSPATR-Name)
0 Reverse Image (RI)
1 High Intensity (HI)
2 Underline (UL)
3 Blink (BL)
4 Column separator (CS)
5 Always 1
6 Always 0
7 Protect (PR)

Attribute to color mapping

As stated, color was introduced later. Hence, display attribute bits have been reused for setting color:

  • Blink = Red
  • Column separator = Turqoise (cyan)
  • High intensity = White

Further colors can be displayed by combining bits 1, 3, and 4:

  • Blink, column separator = Pink (magenta)
  • Blink, column separator, high intensity = Blue
  • Column separator, high intensity = Yellow

Normally, you don't need to memorize all of that, but just use the DDS COLOR(xxx) keyword to enable the available colors:

Desired color DDS COLOR statement equivalent DDS DSPATR statement
Black   DSPATR(ND)
White COLOR(WHT) DSPATR(HI)
Red COLOR(RED) DSPATR(BL)
Green COLOR(GRN)  
Blue COLOR(BLU) DSPATR(BL CS HI)
Yellow COLOR(YLW) DSPATR(CS HI)
Pink (magenta) COLOR(PNK) DSPATR(BL CS)
Turquoise (cyan) COLOR(TRQ) DSPATR(CS)

All but black can be combined with the Reverse Video (RI) attribute to have black letters on colored background.[3]

Depending on the settings of the used color display terminal or emulator, attributes and color might be shown concurrently. This is most apparent when setting the color of an input capable field to cyan, and the result not only is cyan, but also looks ugly, due to column separators being displayed. Most display terminals or emulators have a configuration setting to only show colors and not apply attributes.[4]

Weblinks

Footnotes

  1. The DDS logic takes care to switch off set attributes after a screen element's end.
  2. It should be noted that in a subfile, each record has an independent set of indicators.
  3. This should be used sparsely, because it's very eye straining.
  4. Due to reusing of attribute bits, changing this setting disables the display of attributes globally. You can't then display one field with e. g. column separators. Instead, the field is then colored cyan.