Numeric Variables


ANSI

 

Numeric variables are defined as a BOOLEAN, FORM, or INTEGER type. BOOLEAN or FORM variables contain numeric data in a valid decimal number format, while INTEGER variables only contain whole, unsigned numeric data in a machine specific format. Either may be used in any mathematical instruction though FORM variables lend themselves to accounting functions and INTEGER variables lend themselves to high-speed counting or loop functions.

Note the following:

  1. The format of a numeric variable is set at definition. Whenever a new value is assigned, it is aligned to this definition.

  2. The physical length of a FORM variable may not exceed 32 bytes (including the decimal) while an INTEGER variable is limited to 4 bytes.

  3. If the numeric variable is a FORM and contains a decimal, the results of any arithmetic instruction are aligned to the decimal.

  4. When arithmetic instructions involving FORMs exceed the size of the destination variable, truncation, rounding or both may occur.

  5. When arithmetic instructions involving INTEGERs exceed the size of the destination variable, truncation occurs on the most significant bytes.

  6. BOOLEAN variables may only contain a value of zero (FALSE) or one (TRUE).

 

 

See Also: Data Definitions

 



PL/B Language Reference NINIT FORM