Numeric data
The numeric data type declared in the TYPE keyword is used to specify the output numeric data type.
You can use the following formats to code numeric data:
- INTEGER or INT
- Whole numbers in a binary word of 31 bits plus the sign.
- SMALLINT
- Whole numbers in a binary halfword of 15 bits plus the sign.
- DECIMAL(n,m) or DEC(n,m)
- Standard decimal value that is contained in (n/2+1) bytes. The default value is DECIMAL or DEC and is equivalent to DECIMAL (5,0).
- DECIMAL ZONED(len,scale)DECIMAL ZONED(len)DECIMAL ZONED
- The format of a zoned number is znznzn...z/sn,
where n denotes a 4-bit decimal digit (called the
numeric bits); z is the digit's zone (the left
four bits of a byte); s is the right-most operand
that can be a zone (z) or a sign value (hexadecimal
A, C, E, or F for a positive number, and hexadecimal B or D for a
negative number).
- len
- Specifies the number bytes (decimal digits) in the output field. The length must be 1 - 31. If the source data type is DECIMAL and the length parameter is omitted, the default length is determined by the column attribute that is defined in the table. Otherwise, the default length is 31 bytes.
- scale
- Specifies the number of digits to the right of the decimal point (a decimal point is not included in the output field in this case). There must be an integer that is greater than or equal to zero and must be less than or equal to the length. The default depends on the column attributes that are defined in the table. If the source data type is DECIMAL, the defined scale value is taken as the default value; otherwise, the default is 0.
An error occurs if the output field size that is specified is less than the data length. If the size of the output field is less than the data length, X'F0' is padded on the left.
- FLOAT(n)
- Number (n) is simple floating point precision
if (0<n<22) in a fullword. Number is double
floating point precision if (21<n<54).
The default type for FLOAT is double precision.