The DEFAULT_VALUE field attribute clause sets a default value for a field accessed by VAX DATATRIEVE.
1 – Parameters
fixed_point_number
dtrdv_quoted_string
A VAX DATATRIEVE expression that is the default value.
2 – Syntax Rules
o The quoted string (dtrdv_quoted_string) or fixed point number
must be a valid VAX DATATRIEVE expression. However, the CDDL
compiler does not check for correct syntax. It is your
responsibility to provide a correct default value expression.
o You can use 8-bit characters in CDDL quoted strings.
3 – Usage Notes
o The DEFAULT_VALUE clause, used with VAX DATATRIEVE, serves much
the same purpose as the INITIAL_VALUE clause. The main
difference is that the INITIAL_VALUE clause assigns a value to a
field when the field is first allocated, usually at compile time,
but the DEFAULT_VALUE clause assigns a value to a field each time
the record is stored without an explicit value assigned to it.
o Only VAX DATATRIEVE supports the DEFAULT_VALUE clause. Other
language processors ignore it.
4 – Example
The following example assigns a DEFAULT_VALUE of 0 to the field
TOTAL_PRICE.
TOTAL_PRICE DATATYPE IS VIRTUAL FIELD
COMPUTED BY DATATRIEVE AS
"UNIT_PRICE * QUANTITY"
DEFAULT_VALUE FOR DATATRIEVE IS 0.