(Contents)(Previous)(Next)

Options for the Output of Numerical Columns

All numerical columns of the result table can be edited by using the functions SCALE, ROUND, and TRUNC. The data can have any external format because the functions are applicable to columns that are to be output in CHAR format as well as to columns in REAL, ZONED, or other formats.

The scaling factor specified after the keyword SCALE can be positive or negative. The value to which the function is referring will be multiplied by the corresponding decimal power.

The ROUND and TRUNC functions determine the fractional digits of a number. The number n of fractional digits must lie between 0 and 18. If the number has no fractional digits, the functions have no effect.

TRUNC n means that the n+1st and all the following fractional digits of the number are set to 0, while the first n fractional digits remain unchanged.

ROUND n means that the number is to be rounded from right to left starting with the n+1st fractional digit. If this digit is greater than or equal to 5, the nth digit will be incremented by 1. In this case, too, the result is a number with the n+1st and all the following fractional digits equal to 0; but the first digits of the number may be modified by rounding up.

Both ROUND and TRUNC can be applied in combination with the SCALE function. The functions must be specified in the following order: SCALE before ROUND or TRUNC. The order of processing corresponds to this order.

Example:

DATAEXTRACT * FROM distance

...

cm 10-13 INTEGER SCALE 2

meter 14-17 INTEGER

km 18-21 INTEGER SCALE -3 ROUND 0

...

OUTFILE dimensions.bin

If numbers are output in plaintext, the CHAR FLOAT option can be used to obtain a floating point representation of these numbers, regardless of their size. If the SCALE function is applied and numbers to be output become so large or so small that they cannot be represented any more as fixed point numbers, then they are automatically output in floating-point format.


(Contents)(Previous)(Next)