HP 3000 Manuals

Conversion Functions [ HP ALLBASE/BRW Reference Manual ] MPE/iX 5.0 Documentation


HP ALLBASE/BRW Reference Manual

Conversion Functions 

Four built-in standard conversion functions are available for HP
ALLBASE/BRW's calculation language.  They are described in the following
table.

          Standard Conversion Functions 
------------------------------------------------------------------------------------------
|                                                                                        |
| TO_INTEGER(expr)      The TO_INTEGER function converts the argument, expr to an        |
|                       integer.  This function is valid for real, numeric, and string   |
|                       values of expr.                                                  |
|                                                                                        |
|                       If the number is out of range, or if the expression is a string, |
|                       the string does not convert, the function returns an             |
|                       ILLEGAL_VALUE message.  In all cases except for a real value of  |
|                       expr, the value is truncated.  In the case of a real value, it   |
|                       is rounded.  Digits following a decimal point in a string are    |
|                       ignored.                                                         |
|                                                                                        |
| TO_REAL(expr)         The TO_REAL function converts the argument, expr to a real       |
|                       value.  This function is valid for integer, numeric, and string  |
|                       values of expr.                                                  |
|                                                                                        |
|                       Out-of-range values of expr are truncated.  String values that   |
|                       do not convert cause the function to return an ILLEGAL_VALUE     |
|                       message.                                                         |
|                                                                                        |
| TO_NUMERIC(expr)      The TO_NUMERIC function converts the argument, expr to a numeric |
|                       value.  This function is valid for integer, real, and string     |
|                       values of expr.                                                  |
|                                                                                        |
|                       Strings that contain more than 13 digits before the decimal      |
|                       cause the function to return an OVERFLOW message.  Only 6 digits |
|                       after the decimal are significant.  Any subsequent digits are    |
|                       ignored.  String values that do not convert cause the function   |
|                       to return an ILLEGAL_VALUE message.                              |
|                                                                                        |
|                       If a real value of expr is specified that is outside the range   |
|                       of valid numeric values, the function returns an OVERFLOW        |
|                       message.                                                         |
|                                                                                        |
| TO_STRING(expr)       The TO_STRING function converts the argument, expr, to a string  |
|                       value.  This function is valid for integer, numeric, and real    |
|                       values of expr.  A default format is used when converting the    |
|                       argument.  This format varies, depending on the source data      |
|                       type.                                                            |
|                                                                                        |
|                       The default format for integers consists of 10 digits with a     |
|                       leading sign that is blank for positive integers.  The number is |
|                       right justified.                                                 |
|                                                                                        |
|                       The default of numeric values of expr is 22 characters, right    |
|                       justified, with a leading sign, an embedded decimal point, and 6 |
|                       digits after the decimal.                                        |
|                                                                                        |
|                       The default format for real values is the standard G22.16        |
|                       format, right justified, with a leading sign.                    |
|                                                                                        |
------------------------------------------------------------------------------------------

Related Sections 

   *   Arguments

   *   Functions

   *   Numbers, real

   *   Standard Functions



MPE/iX 5.0 Documentation