# Rexx - DataTypes

In any programming language, you need to use various variables to store various types of information. Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in the memory to store the value associated with that variable.

You may like to store information of various data types like String, Character, Wide Character, Integer, Floating Point, Boolean, etc. Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory.

## Built-in Data Types

Rexx offers a wide variety of built-in data types. Following is a list of data types which are defined in Rexx.

**Integer**− A string of numerics that does not contain a decimal point or exponent identifier. The first character can be**a plus (+) or minus (-) sign**. The number that is represented must be between -2147483648 and 2147483647, inclusive.**Big Integer**− A string of numbers that does not contain a decimal point or an exponent identifier. The first character can be a plus (+) or minus (-) sign. The number that is represented must be between -9223372036854775808 and 2147483648, inclusive, or between 2147483648 and 9223372036854775807.**Decimal**− It will be from one of the following formats −A string of numerics that contains a decimal point but no exponent identifier. The

**p**represents the precision and**s**represents the scale of the decimal number that the string represents. The first character can be a plus (+) or minus (-) sign.A string of numerics that

**does not contain a decimal point**or an exponent identifier. The first character can be a plus (+) or minus (-) sign. The number that is represented is less than -9223372036854775808 or greater than 9223372036854775807.

**Float**− A string that represents a number in scientific notation. The string consists of a series of numerics followed by an exponent identifier (an E or e followed by an optional plus (+) or minus (-) sign and a series of numerics). The string can begin with a plus (+) or minus (-) sign.**String**− A normal string of characters.

Following are some examples of how each data type can be used. Again each data type will be discussed in detail in the subsequent chapters. This is just to get you up to speed with a brief description of the above mentioned data types.

### Integer

An example of how the number data type can be used is shown in the following program. This program shows the addition of 2 Integers.

**Example**

/* Main program The below program is used to add numbers Call the add function */ add(5,6) exit add: parse arg a,b say a + b

The output of the above program will be −

11

### Big Integer

The following program shows the capability of Rexx to handle big integers. This program shows how to add 2 big integers.

**Example**

/* Main program The below program is used to add numbers Call the add function */ add(500000000000,6000000000000000000000) exit add: parse arg a,b say a + b

The output of the above program will be −

6.00000000E+21

### Decimal

The following program shows the capability of Rexx to handle decimal numbers. This program shows how to add 2 decimal numbers.

**Example**

/* Main program The below program is used to add numbers Call the add function */ add(5.5,6.6) exit add: parse arg a,b say a + b

The output of the above program will be −

12.1

### Float

The following example show cases how a number can work as a float.

**Example**

/* Main program The below program is used to add numbers Call the add function */ add(12E2,14E4) exit add: parse arg a,b say a + b

The output of the above program will be −

141200

### String

An example of how the Tuple data type can be used is shown in the following program.

Here we are defining a **Tuple P** which has 3 terms. The **tuple_size** is an inbuilt function defined in Rexx which can be used to determine the size of the tuple.

**Example**

/* Main program */ display("hello") exit display: parse arg a say a

The output of the above program will be −

hello