COLOR (Color) keyword for display files

You use this keyword to specify the color of a field on a color display.

This field-level keyword specifies the color of a field on a color display (3179, 3197 Models C1 and C2, 3477 Model FC, 3486, 3487 Model HC, 34881 or 5292 Color Display Stations only). This keyword is ignored if it is selected for a field displayed on monochrome display stations. You can specify one parameter value for the COLOR keyword, but you can specify more than one COLOR keyword on each field.

The format of the keyword is:

COLOR(GRN | WHT | RED | TRQ | YLW | PNK | BLU)

The valid parameter values are:

Value
Meaning
GRN
Green
WHT
White
RED
Red
TRQ
Turquoise
YLW
Yellow
PNK
Pink
BLU
Blue

Because green is the default color of the fields on color display stations, you need to specify COLOR(GRN) only to keep the color of a field green. Specifying DSPATR(HI), DSPATR(CS), or DSPATR(BL) for a field changes the color of the field unless you also specify COLOR(GRN).

Option indicators are valid for this keyword.

When you specify the COLOR keyword more than once for a field, you must specify option indicators with each COLOR keyword. If more than one COLOR keyword is in effect for an output operation, the IBM® i operating system uses the first COLOR keyword that is specified in the DDS (see Example 1). You cannot specify the same color more than once for a field.

The number of COLOR keywords you can specify in one display file is limited by the maximum size of an internal storage area of the system called the screen attribute array. The maximum size of the screen attribute array is 32 763 bytes for the entire display file. Each COLOR keyword you specify in the file uses up a significant amount of storage within this array.

If you use many COLOR keywords in a file, particularly with conditioning, you should consider the amount of internal storage these keywords will require. If the 32 763-byte limit is exceeded, message CPF0673 (Too many COLOR or DSPATR keywords specified in file) is issued during file creation. To determine the amount of storage required for a particular COLOR keyword, use the following algorithm:

(# of conditions for the keyword) x 2 + 2 + 29 = # of bytes required
in the screen
attribute array
for the keyword

For example, suppose a file contains 8 fields, each field contains 9 COLOR keywords, and each COLOR keyword is optioned using 3 conditions. Using the above algorithm, each COLOR keyword requires 520 bytes in the screen attribute array:

3 x 2 + 2 + 29 = 520 bytes

Because there are nine COLOR keywords per field and eight fields in the file, the total storage required in the screen attribute array is 37 440 bytes (520 x 9 keywords x 8 fields). Because 37 440 is greater than 32 763, message CPF0673 is issued at file-creation time.

Using the COLOR keyword with the DSPATR keyword

In some combinations of COLOR and DSPATR, both keywords have effect. Those combinations are:

COLOR
DSPATR
Any
RI (reverse image)
Any
UL (underline)
RED
BL (blinking field)
RED
BL and RI
RED
BL and UL
RED
RI and UL
GRN
RI and UL
TRQ
RI and UL
PNK
RI and UL

For example, if COLOR(YLW) and DSPATR(RI) are both in effect, the field appears as black characters on a yellow background.

In some combinations of the COLOR and DSPATR keywords, some of the parameter values are ignored. Those combinations are shown in the following table.

COLOR DSPATR Effect

Any
Any
Any

ND (nondisplay)
HI (high intensity)
CS (column separators)

All colors are ignored
HI is ignored
CS is ignored1

GRN
WHT
TRQ
YLW
PNK
BLU

BL
BL
BL
BL
BL
BL

BL is ignored2
BL is ignored2
BL is ignored2
BL is ignored2
BL is ignored2
BL is ignored2

RED RI and BL and UL UL is ignored3
YLW BLU WHT

RI and UL
RI and UL
RI and UL

RI is ignored
RI is ignored
RI is ignored

1Turquoise and yellow fields have column separators even if DSPATR(CS) is not specified. (The column separators appear as small blue dots between characters on color displays. They disappear when the display station user sets the color display station for reduced line spacing.)

2The only color that can blink is red.

3Underlines are also removed from input-capable fields, which are underlined by default.

For example, if COLOR(YLW) and DSPATR(HI) are both selected for an output operation, the field is yellow but not high intensity.

Using the DSPATR keyword on color displays

When you specify the DSPATR keyword without the COLOR keyword, fields are displayed on color displays with the colors in the following table but without the specified display attributes.

Table 1. DSPATR keyword on color displays
DSPATR(CS) display attribute selected DSPATR(HI) display attribute selected DSPATR(BL) display attribute selected Color produced on the color display station
      Green (normal)
X     Turquoise1
  X   White
    X Red, no blinking
  X X Red, with blinking
X X   Yellow1
X   X Pink
X X X Blue
1Turquoise and yellow fields are displayed with column separators (which are always blue) except when the workstation user sets the color display station for reduced line spacing.

For example, if DSPATR(HI) is selected for a field and the COLOR keyword is not specified, the field is white but not highlighted on a color display.

The COLOR keyword is ignored if it is selected for a monochrome display.

Example 1

The following example shows the effects of specifying COLOR and DSPATR for a field.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RECORD                    1
00020A                                  1  2'Column Heading'
00030A                                      DSPATR(HI)
00040A       2  FIELD1         5      3  2
00050A       3  FIELD2         5   I  5  2COLOR(YLW)
00060A       4  FIELD3         5      7  2DSPATR(BL)
00070A       5  FIELD4         5   I  9  2
00080A  42                                  COLOR(YLW)
00090A  43                                  COLOR(TRQ)
00100A  44                                  COLOR(BLU)
     A
1
On color displays, the constant field Column Heading is white; on monochrome displays, it is highlighted.
2
On all displays, FIELD1 is green.
3
On color displays, FIELD2 is yellow with blue column separators. On all displays, the field is underlined because it is an input-capable field.
4
On color displays, FIELD3 is red and does not blink; on monochrome displays, it blinks.
5
On color displays, FIELD4 can appear in one of the following colors:
  • Green, if no indicators are on
  • Yellow, if indicator 42 is on (no matter how other indicators are set)
  • Turquoise, if indicator 43 is on and indicator 42 is off
  • Blue, if indicator 44 is the only indicator on

On monochrome displays, FIELD4 is green. On all displays, FIELD4 is underlined.

Example 2

The following example shows one way of specifying a field for use as an input-capable field on both color and monochrome displays.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RECORD
00020A 2 1      FIELDA         5   B  2  2COLOR(TRQ)
00030A  44                                  ERRMSG('Record not found' 44)
     A
1
On color displays, FIELDA is turquoise with blue column separators; on monochrome displays, it is green.
2
If option indicator 44 is set on when FIELDA is displayed, the ERRMSG keyword is in effect and has the following effect:
  • On color displays, FIELDA is turquoise and its image is reversed. (Because of the COLOR keyword, it is not highlighted.) The error message Record not found is displayed on the message line in white.
  • On monochrome displays, FIELDA is highlighted and its image is reversed. The error message Record not found is also highlighted and is displayed on the message line.
1 Dependent on the monitor attached to the display device.