DFT (Default) keyword for display files

You use this field-level keyword to specify the constant value for constant fields (unnamed fields) and to specify a default value for named fields.

The format of the keyword is:

DFT('value') | 'value'

The maximum number of characters you can specify in the literal is set by the size of the display on which the field is to be displayed as follows:

Size of display
Maximum characters
24 x 80
1919
27 x 132
3563

Constant fields

The value of a constant field can be specified as a value enclosed by single quotation marks. (For other ways to specify a constant field, see the DATE, MSGCON, and TIME keywords.) You can omit the DFT keyword itself, as well as the parentheses, to simplify the DDS. Whether you specify the DFT keyword explicitly or implicitly, the IBM® i operating system displays the specified value as a constant field on the display. See Name for display files (positions 19 through 28) for a description of constant fields.

Named fields

For input-only fields, the specified value is displayed each time the field is displayed. The displayed value can then be changed by the workstation user and returned to your program.

For output-only and input/output fields, you must also specify PUTOVR at the record level and OVRDTA at the field level with the DFT keyword. The specified value is displayed only on the first output operation. On subsequent output operations, the program value is displayed.

The DFTVAL, EDTCDE, and EDTWRD keywords cannot be specified with the DFT keyword.

The DFT keyword is not valid on floating point fields.

Option indicators are not valid for this keyword, although option indicators can be used to condition the field (whether constant or named) on which it is specified.

Example 1

The following example shows how to specify the DFT keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00030A            HOTTYP         1   I  7  9DFT('D')
00040A                                      VALUES('D' 'S')
00050A                                  8  9'ON'
00060A        01                       12  1'HOTEL NAME: 'TERRACE INN'
00070A                                      TEXT('Constant field is +
00080A                                      conditioned, not the implicit +
00090A                                      DFT keyword')
00100A        02                       12  1'HOTEL NAME: 'RIVER VIEW INN'
00110A                                      TEXT('Either 'TERRACE INN' or +
00120A                                          'RIVER VIEW INN' could +
00130A                                          appear in line 12, position 1')
     A

The constant field ON, having no option indicators, is always displayed.

If indicator 01 is on, the following information is displayed:

HOTEL NAME:  'TERRACE INN'

If indicator 02 is on and indicator 01 is off, the following information is displayed:

HOTEL NAME:  'RIVER VIEW INN'

Example 2

If you are specifying a constant field for more than one display size, and you are changing the location of the field but not the contents of the field for the different display sizes, then do not repeat the value. The following example shows how to do this.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      DSPSIZ(*DS3 *DS4)
     A                                      :
     A                                      :
00080A                                 22  2'Constant data'
00090A                                 26  2
     A

The constant field Constant data appears on line 22, position 2, on the 24 x 80 display screen, and it appears on line 26, position 2, on the 27 x 132 display.