DFTVAL (Default Value) keyword for display files

You use this field-level keyword to specify a default value for an output-capable field.

On the first output operation, the specified value is displayed if the option indicator is on or has not been specified. Otherwise, the program value is used. On subsequent output operations, the program value appears.

The format of the keyword is:

DFTVAL('value')

This keyword is valid on output-only (O) or output-input (B) fields.

You can only use this keyword to initialize named fields. It is not allowed on constant fields.

Since the maximum number of characters on a DDS statement is 5000, this keyword, along with any other keywords specified on the DDS statement, must contain less than 5000 characters.

You cannot use this keyword in a subfile format (SFL keyword).

You cannot specify the DFTVAL keyword on the same field with a DFT, EDTCDE (Edit Code), or EDTWRD (Edit Word) keyword, or on a floating-point field.

Option indicators are valid for this keyword.

Example

The following example shows how to specify the DFTVAL keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A          R RECORD1
     A  50                                  PUTOVR
     A            FIELD1         3A  B 12 01DFTVAL('AAA') OVRDTA
     A            FIELD2         3D 0O 12 05OVRDTA
     A  10                                  DFTVAL('000')
     A            FIELD3         3D 0O 12 09DFTVAL('000') OVRDTA
     A

In this example, before displaying the record, the application program assigns ZZZ to FIELD1, 999 to FIELD2, and 456 to FIELD3. On the first output operation, AAA 000 000 displays if indicator 10 is on; AAA 999 000 displays if indicator 10 is off.

The workstation user types XXX into FIELD1. On the second output operation, XXX 999 456 displays if indicator 50 is on; AAA 000 000 displays if indicator 50 is off and indicator 10 was on during the first output operation. AAA 999 000 displays if indicator 50 is off and indicator 10 was off during the first output operation.