Input field default values

You can use these methods to put default values into the input fields of your display. Users can override the default values with their own data.

  • Getting information from program

    Never hard code the values as a literal if they are language or cultural-dependent values. Use values you can get from the system-provided information, such as system or job date, or get the values from a data object, such as a database file or data area from outside of the program.

  • Using DDS keywords DFT (Default) or DFTVAL (Default Value)

    Specify the default input value directly on the DDS after the keyword. The DDS keyword DFT is for input-only (I) fields. For output-only (O) or input-output (B) fields, use the keyword DFTVAL.

    For example:

    A     field-name   length type I   line pos  DFT('default    ')
    or
    A     field-name   length type O/B line pos  DFTVAL('default value ')
  • Using DDS keyword MSGID (Message Identification)

    Using the Message Identification (MSGID) keyword allows you to retrieve the content of a specified message description when the program is run and to put that value as a default in your display file field. The field must be input-output capable (B) for you to use this technique.

    For example:

    A   field-name  length type B line pos  MSGID(message-id [*libl/message-file)

    This allows you to use different message files for each national language version by setting the library list accordingly when the program is run.