DECIMAL data is in packed decimal format: two digits per byte, except for the last byte, which contains a digit and sign.
DECIMAL fields allow the specification of an implied decimal point, so fractional values can be represented.
The syntax for the
DECIMAL data type is:
precision parameter is the number of digits in a value. The length of the field in bytes, as computed from digits, is (N+1)/2 rounded up.
scale parameter is the scaling factor, or number of digits to the right of the decimal point. The default is zero (indicating an integer). The scaling factor can be greater than the number of digits but cannot be negative.
An example is:
sal DECIMAL (7,2)
This example would load a number equivalent to +12345.67. In the data record, this field would take up 4 bytes. (The byte length of a
DECIMAL field is equivalent to (N+1)/2, rounded up, where
N is the number of digits in the value, and 1 is added for the sign.)