Use this field-level keyword to specify a default value for a field.
The format of the keyword is:
DFT('value' | numeric-value | X'hexadecimal-value' | *NULL)
Without this keyword, character and hexadecimal fields default to blanks
and numeric fields default to zeros. However, if you specify the
ALWNULL keyword for the field, then the character, hexadecimal, and numeric
fields default to the null value.
The following rules apply to the specified value:
- If the field being defined is a character field, specify a character
constant, hexadecimal value, or *NULL. Specify character strings within
apostrophes. If the field is variable length (VARLEN), then the length
of the string must be less than or equal to the allocated length.
Specify hexadecimal values as an X followed by a combination of the digits
0 through 9 and the letters A through F. Enclose the combination in
apostrophes. The number of hexadecimal digits in apostrophes must be
exactly twice the specified length of the field. If the field is
variable length (VARLEN), then the number of hexadecimal digits in apostrophes
must be exactly twice the allocated length.
- If the field being defined is a hexadecimal field, specify a character
constant, hexadecimal value, or *NULL.
- Note:
- If a character constant is specified, the hexadecimal representation of the
character constant is the default value.
Specify character strings within apostrophes. If the field is
variable length (VARLEN), then the length of the string must be less than or
equal to the allocated length.
Specify hexadecimal values as an X followed by a combination of the digits
0 through 9 and the letters A through F. Enclose the combination in
apostrophes. The number of hexadecimal digits in apostrophes must be
exactly twice the specified length of the field. If the field is
variable length (VARLEN), then the number of hexadecimal digits in apostrophes
must be exactly twice the allocated length.
- If you are defining a numeric field, specify a numeric value (digits 0
through 9 specified without apostrophes) or *NULL. For a value other
than zero in positions 36 and 37, specify the decimal character with a numeric
constant in the appropriate position in the DDS.
- If you specify *NULL, then you must also specify the ALWNULL keyword on
the field.
- If you do not specify any value (DFT('')), this indicates a
default of a 0 length string and is valid only when the field is variable
length (the VARLEN keyword must also be specified).
- If you are defining a date field, specify a valid date in the same format
specified on the DATFMT keyword and use the same separator as specified on the
DATSEP keyword. For example, DFT('12/15/91') is
the default value if *MDY is specified for DATFMT and '/' is specified
for DATSEP.
If the DFT keyword is not specified, the default value is the current
date.
- If you are defining a time field, specify a valid time in the same format
specified on the TIMFMT keyword and use the same separator as specified on the
TIMSEP keyword. For example,
DFT('11.00.00') is the default value if
*ISO is specified for TIMFMT. The default separator for *ISO is a
period (.).
If the DFT keyword is not specified, the default value is the current
time.
- If you are defining a timestamp field, you must specify the default value
in the following format:
DFT('YYYY-MM-DD-HH.MM.SS.UUUUUU')
If the DFT keyword is not specified, the default value is the current
time.
The value specified is assigned to the field in the following cases:
- When the program does an output operation to a logical file based on this
physical file and the record format in the logical file does not name this
field.
- When you use the Initialize Physical File Member (INZPFM) command for a
member in this file.
- When you use the Copy File (CPYF) command with FMTOPT(*MAP) specified and
a field in the to-file is not in the from-file.
The specified value is supplied to the program when the program does an
input operation to a join logical file and all of the following are
true:
- You specify the JDFTVAL keyword for the join logical file.
- The file being defined is specified as a secondary file in the join
logical file.
- When the input operation occurs and the link to the secondary file
produces no records.
This keyword does not affect the physical file on input operations.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.