IBM i DDS Display File Field Keywords: CHECK, EDTCDE, EDTWRD, COLOR and DSPATR

A DDS display file controls a field’s behaviour and appearance with keywords coded in the keyword area of the field line. This page is a lookup for five of the most used field-level keywords: CHECK for validity checking, EDTCDE and EDTWRD for numeric editing, and COLOR and DSPATR for screen attributes. It does not cover subfile paging keywords (SFLPAG, SFLSIZ, SFLCTL and related), which are covered in Load-All Subfile Programming in RPGLE and Expandable Subfile Programming in RPGLE.

All keyword names, codes and column positions below are checked against IBM’s DDS Reference for Display Files. No example on this page has been compiled; they are marked IBM DOC CHECKED or STATIC CHECKED, never compiler tested.

Where a field keyword goes

A display file source member is a fixed-column form. For a field-level line, IBM’s positional-entries table gives these columns:

PositionsEntryPurpose
6Form typeA marks the line as a DDS display-file specification. Optional and for documentation only — the compiler does not require it, but every line in this article’s examples carries it by convention.
17Type of name/specificationR identifies this line as a record-format name (the name in 19–28 is the record format); left blank on an ordinary field line
19–28NameThe record format name (when position 17 is R) or the field name
29ReferenceR to copy attributes from a field defined elsewhere
30–34LengthThe field’s length, required unless copied from a referenced field
35Data typeData type and keyboard-shift attribute
36–37Decimal positionsDecimal placement for zoned numeric fields
38UsageO output, I input, B both, H hidden, P program-to-system, M message
39–44LocationThe row and column where the field starts on the screen
45–80KeywordsOne or more keywords, continued onto following lines as needed

(IBM i DDS Reference, “Positional entries for display files” and “DDS syntax for a display file”.) Everything in this article lives in columns 45–80, one or more keywords per field, continued onto extra lines when a keyword runs long. A continuation line for an extra keyword leaves positions 7–44 blank (name, length, and the rest do not repeat) and starts the next keyword at position 45 like any other.

     A          R RECORD1
     A            CUSTNO         6  0B  5  3EDTCDE(3)
     A                                      CHECK(ME)

IBM DOC CHECKED — column layout from the DDS Reference; this fragment is not compiled.

CHECK: field-level validity checking

CHECK tells the system to validate typed input against one or more codes and to show an error message when a code fails. The syntax is CHECK(code {code ...}); more than one code can be given in one CHECK keyword, separated by blanks.

CodeMeaningRestrictions worth knowing
ABAllow all-blank input to pass, even if another CHECK code on the field would otherwise failField level only, must be paired with another validity keyword, not with SFLROLVAL/SFLRCDNBR, not on floating-point fields
MEMandatory enter: at least one character (a blank counts) must be typedHas no effect unless DSPATR(MDT) is also set on at least one field in the record
MFMandatory fill: once any part of the field is changed, every position must be filledCannot combine with RB, RZ or WRDWRAP
M10 / M10FIBM Modulus 10 self-check digit. M10 checks on Enter or a function key; M10F checks as the user typesNot with COMP(EQ) or on floating-point fields; M10F not with USRDSPMGT, CHKMSGID or WRDWRAP; 31 digits maximum
M11 / M11FIBM Modulus 11 self-check digit, same timing distinction as M10/M10FSame restrictions as M10/M10F; only one modulus algorithm per field
VNValidate the field as a simple nameField must be character and input-capable; cannot combine with M10, M10F, M11, M11F, VNE, COMP, RANGE or VALUES
VNEValidate the field as an extended name (up to 255 characters, optionally quoted)Same exclusions as VN
ERField exit on Enter: sends the record once the last input position is filledEquivalent to AUTO(RA); use on the last input field only
FEField exit required: the user must leave the field with a Field Exit keyInput fields only
RBRight-adjust with blank fillEquivalent to AUTO(RAB); not with WRDWRAP
RZRight-adjust with zero fillEquivalent to AUTO(RAZ); same limits as RB

(IBM i DDS Reference, “CHECK (Check) keyword for display files”.) At display file creation time, CHECK and the other validity-checking keywords are copied from the underlying physical or logical file if the display field references one; coding CHECK directly on the display field overrides that inherited value.

     A          R ORDENT
     A            CUSTNO         6  0B  5 20CHECK(ME)
     A                                      DSPATR(MDT)
     A            CUSTNM        30   B  6 20CHECK(VN)

IBM DOC CHECKED. CUSTNO requires at least one character typed, and DSPATR(MDT) is present so IBM enforces ME. CUSTNM must be a simple name under VN‘s rule — not literally “valid” in the sense of arbitrary business validation, but a specific character-class check IBM defines for name-shaped input.

EDTCDE and EDTWRD: numeric output editing

Both keywords format an output-capable numeric field for display. They are mutually exclusive on the same field — a field can specify EDTCDE or EDTWRD, never both — and neither can be combined with DFT or DFTVAL.

EDTCDE

Syntax: EDTCDE(edit-code {* | floating-currency-symbol}). The edit code is one of IBM’s predefined codes (or a user-defined code created with CRTEDTD), and the optional second part asks for asterisk fill or a floating currency symbol tied to the QCURSYM system value. IBM’s standard edit codes control leading-zero suppression, comma and decimal-point insertion, negative sign or CR display, and zero-value display.

     A            AMOUNT         9  2O  8 10EDTCDE(J)

IBM DOC CHECKED. Edit code J is one of IBM’s predefined codes that suppresses leading zeros, inserts commas and a decimal point, and shows a trailing minus sign for negative values — check IBM’s edit-code table for the exact code you need, since several codes differ only in zero-suppression and sign placement.

EDTWRD

Syntax: EDTWRD('edit-word'). An edit word is a user-built mask using IBM’s placeholder characters (digit position, zero-suppress position, fixed text such as separators) rather than a predefined code, and it is the documented fallback “when none of the standard edit codes or user-defined edit codes is adequate” (IBM i Edit Function APIs). It is commonly used for patterns no edit code reaches, such as inserting a hyphen into a non-decimal numeric field.

     A            PHONENO        7  0O  9 10EDTWRD('   -    ')

STATIC CHECKED against IBM’s description of edit-word placeholders; the exact placeholder spacing for a 7-digit phone mask has not been compiler-verified in this workspace, so treat the literal mask string as illustrative and confirm it against IBM’s Edit Function APIs documentation before using it as-is.

DLTEDT is the companion keyword: it tells the system to ignore an inherited EDTCDE or EDTWRD from a referenced field. IBM notes that coding a new editing keyword on the display field makes DLTEDT unnecessary, since the new keyword already overrides the inherited one.

COLOR: field color

Syntax: COLOR(color-value), where color-value is one of BLU, GRN, WHT, RED, TRQ, YLW or PNK (IBM i DDS Reference, “COLOR (Color) keyword for display files”). Green (GRN) is the default color on color display stations, so coding COLOR(GRN) only matters when another keyword would otherwise change the color and you want to keep it green.

     A            STATUS        10   O 12 10COLOR(RED)

IBM DOC CHECKED. If more than one COLOR keyword were coded for the same output operation on a field, IBM’s rule is that the system uses the first one specified in the DDS — so duplicate COLOR keywords on one field are a silent no-op for every entry after the first, not an error. COLOR is ignored on monochrome display stations.

A field-level interaction to watch: DSPATR(HI), DSPATR(CS) and DSPATR(BL) each change a field’s color unless COLOR(GRN) is also specified on that field.

DSPATR: display attributes

Syntax: DSPATR(attribute {attribute ...}), or repeated DSPATR keywords — IBM’s reference gives both DSPATR(RI HI) and DSPATR(RI) DSPATR(HI) as equivalent ways to reverse-image and highlight the same field. Each individual attribute can be specified only once per field.

AttributeEffect
HIHigh intensity
RIReverse image
ULUnderline
BLBlinking
CSColumn separator
NDNondisplay
MDTSets the Modified Data Tag as though the user had typed in the field — the precondition CHECK(ME) needs to be enforced

(IBM i DDS Reference, “DSPATR (Display Attribute) keyword for display files”.) IBM notes a specific combination effect: specifying UL, HI and RI together on a 5250 display station produces the same visible result as ND alone, so that combination is a documented way to accidentally hide a field.

     A            BALANCE       11  2O 14 10DSPATR(HI)
     A                                      COLOR(RED)

IBM DOC CHECKED. BALANCE displays high-intensity and red; because DSPATR(HI) alone would change the color, COLOR(RED) is coded explicitly rather than left to chance.

Common mistakes

  • Coding both EDTCDE and EDTWRD on the same field. They are mutually exclusive.
  • Expecting CHECK(ME) to take effect without DSPATR(MDT) on at least one field in the record — IBM states this is a precondition for enforcement, not a side note.
  • Combining M10F with CHKMSGID, USRDSPMGT, or WRDWRAP, each of which IBM documents as incompatible with the as-you-type modulus check.
  • Assuming a second COLOR keyword on the same field overrides the first. IBM uses the first one coded and ignores the rest.
  • Treating EDTWRD as a validity check. Both EDTCDE and EDTWRD are output formatting only; they do not reject bad input the way CHECK, COMP, RANGE or VALUES do.
  • Forgetting that CHECK and the other validity-checking keywords are inherited from a referenced physical or logical file and silently overridden when you code CHECK again on the display field.

FAQ

Can I use CHECK and COMP on the same field?

Not with every CHECK code. IBM explicitly excludes COMP when VN or VNE is coded. Check the restriction list for the specific CHECK code before combining it with COMP, RANGE or VALUES.

What is the difference between EDTCDE and EDTWRD?

EDTCDE applies one of IBM’s predefined (or CRTEDTD-created) edit codes. EDTWRD builds a custom mask from placeholder characters. They cannot both be coded on the same field; use EDTWRD only when no edit code produces the pattern you need.

Why doesn’t my CHECK(ME) field enforce mandatory entry?

ME has no effect unless DSPATR(MDT) is set on at least one field in the record, per IBM’s documentation. Add DSPATR(MDT) to the field (or another field in the same record format) and retest.

Summary

  • Field-level keywords are coded in positions 45–80 of a DDS display file source line, after the name (19–28), length (30–34), data type (35), decimal positions (36–37), usage (38) and location (39–44) entries.
  • CHECK(code {code ...}) performs input validity checking; codes such as ME, MF, M10, M11, VN and VNE each carry their own restrictions and, for ME, a DSPATR(MDT) precondition.
  • EDTCDE and EDTWRD format numeric output and are mutually exclusive on one field.
  • COLOR sets a field’s color from a fixed value list; DSPATR sets one or more display attributes, with documented interactions between DSPATR and COLOR.
  • Every example above is IBM DOC CHECKED or STATIC CHECKED against the cited IBM i documentation; none has been compiled or run in this workspace.

Sources: IBM i DDS Reference for Display Files — positional entries, CHECK keyword, EDTCDE keyword, COLOR keyword, DSPATR keyword, Edit Function APIs (edit word description).

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top