#### NUMBER

#### Synopsis

    HELP:   Convert numbers (local character set required)
    TYPE:   OBJECT
    SYNTAX: NUMBER(FORMAT='str',LOCALE='str',MINIMUM='str',MAXIMUM='str',MININCL,MAXINCL,IGNREST,BASE=num/BIN/B02/OCT/B08/DEC/B10/HEX/B16)

#### Description

This object activates number conversion for a string. If string data containing a number is written to the application memory, it can be transformed to a different representation supported by the runtime environment. Allowed minimum and maximum values (range check) and the target string format can be specified.

The number conversion requires the string to be in the local character set. Character conversion is activated for it. The string may contain leading whitespace. Trailing whitespace or non-convertible characters result in an error unless the IGNREST flag is set. You can use the whitespace handling (WHITESPACE=NUMBER) of the character conversion object as preparation for this conversion.

The format string of the object can, for example, be used to ensure that a number starts with a digit, has two fractional digits, has a sign and so on. The object was mainly designed to convert numbers from XML elements to a display representation for COBOL on mainframe systems. If you need the numbers in a different representation (BCD or two's complement number) for calculations, then you must use the integer or float converter. The use of this object can result in a loss of accuracy. The integer and float converters use an internal number representation without any loss of accuracy.

For integers (u,i,d,x,X), you can specify the base for parsing the data. Default is base 10 for decimal. Floating point numbers (f,g,G,e,E) are always parsed with base 10 and the parameter is ignored.

The range check is based on decimal string values for the maximum and the minimum. The conversion is identical with the data using IGNREST and a base of 10, to make it comparable for integers and floating point numbers.

#### Arguments

- `STRING: MINIMUM='str' - Minimum accepted value in decimal digits [no limit]`
- `STRING: MAXIMUM='str' - Maximum accepted value in decimal digits [no limit]`
- `SWITCH: MININCL - Check range inclusive the given minimum values [FALSE]`
- `SWITCH: MAXINCL - Check range inclusive the given maximum values [FALSE]`
- `SWITCH: IGNREST - Ignore rest after a number was parsed [FALSE]`
- `NUMBER: BASE=num/BIN/B02/OCT/B08/DEC/B10/HEX/B16 - Define the base to parse integer values [10]`
  - `BIN - Binary base (2)`
  - `B02 - Base 2 (binary)`
  - `OCT - Octal base (8)`
  - `B08 - Base 8 (octal)`
  - `DEC - Decimal base (10)`
  - `B10 - Base 10 (decimal)`
  - `HEX - Hexadecimal base (16)`
  - `B16 - Base 16 (hexadecimal)`