HP 3000 Manuals

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


HP ALLBASE/BRW Reference Manual

Types 

This section describes each type of argument in HP ALLBASE/BRW, (Real,
Integer, Numeric, String, Date, or Time), and the operations that can be
performed upon each type.  It describes the standard functions that are
supplied with HP ALLBASE/BRW, and also covers exception handling and
exception conditions.

Summary of Types 

HP ALLBASE/BRW arguments and results can be one of the following types:

N - Fixed-point Numeric   all numbers 

R - Floating-point Real

I - Integer

S - String                characters 

D - Date                  day, month, and year 

T - Time                  hours, minutes, and seconds 

Also, you can manipulate arrays of these types.

Type Mixing 

You can use items of all three number types in the same calculation.
That is, you can multiply Reals by Integers, Numerics by Reals, etc.  The
type of arithmetic performed, and thus the type of the result, follows
the rules below.

   *   If both arguments are Integers, integer arithmetic is used and the
       result is an Integer

   *   If one argument is an Integer, and the other Numeric, or both
       arguments are Numeric, Numeric (fixed-point) arithmetic is used
       and the result is Numeric.

   *   If either or both arguments are Real, Real computation is used and
       the result is Real.

       For example:

               PRICE * QUANTITY

       where PRICE is a fixed-point Numeric item and QUANTITY is an
       Integer.

       The calculation is done with fixed point computation, as one of
       the arguments is a fixed-point (Numeric) value.  The result is
       automatically converted to a fixed-point Numeric value.  Note that
       the type of item QUANTITY is not altered.

Type Conversion 

HP ALLBASE/BRW automatically converts numbers from type to type.  That
is, if you assign an Integer value to a Numeric or Real item, the Integer
is converted to the approriate type.

For example, the index of an array item and the modulo divisor must be
specified as integers.  If you assign a Real or Numeric value to the
modulo divisor or array index, HP ALLBASE/BRW automatically does a type
conversion, and truncates superfluous decimals.  (That is, no error is
returned if you assign a value of a number type to an item or a different
number type.)

Type Conversion with Output Files 

If an item of type Real, Integer, or Numeric is written to a field in a
dictionary output file that is defined to be of a different type of
number, HP ALLBASE/BRW converts the value to the type defined in field of
the dictionary output file.  This can result in an overflow, in which
case an output exception value, as defined by the BRWSETUP program, is
written to the dictionary output file instead.

Automatic type conversion operates only on number types.  For example,
you cannot assign a Date type to a String item!

Related Sections 

   *   Arguments

   *   Exception Handling and Exception Conditions

   *   Items

   *   Standard Functions



MPE/iX 5.0 Documentation