Simple Data Types

Each simple data type of 4GL can store a single value whose maximum storage requirement is specified or implied in the data-type declaration.

4GLREF00000195.gif

maximum size is a whole number from 1 to 255, specifying the largest number of characters that a VARCHAR variable can store.

precision specifies the total number of decimal digits, from 1 to 32.

reserve size is a whole number, from 0 to maximum size. The default is 0.

scale is a whole number, from 1 to precision, specifying the number of digits in the fractional part of a fixed-point number.

size is a whole number from 1 to 32,767, specifying how many characters a CHAR variable stores. The default is 1.

Each simple data type can be classified as a number, time, or character type:

Number Data Types

4GL supports six simple data types to store various kinds of numbers:

Whole Number Data Types

SMALLINT
Whole numbers, ranging from -32,767 to +32,767.
INTEGER
Whole numbers, from -2,147,483,647 to +2,147,483,647.
Fixed-Point Number Data Types

DECIMAL (p,s)
Fixed-point numbers, of scale s and precision p.
MONEY
Currency values, of a definable scale and precision.
Floating-Point Number Data Types

DECIMAL (p)
Floating-point numbers of precision p (or by default, 16).
FLOAT
Floating-point, double-precision numbers.
SMALLFLOAT
Floating-point, single-precision numbers.
Time Data Types

4GL supports three simple data types for storing values in chronological units. Two of these store points in time, and the third can store spans of time (positive or negative differences between points in time):

Date Calendar dates (month, day, year) with a fixed scale of days, within the range of calendar dates from January 1 of the year 1 up to December 31 of the year 9999.

Datetime Instants in time expressed as calendar dates (year, month, day) and time-of-day (hour, minute, second, and fraction of a second), within the range of years 1 to 9999.

Interval Differences between two DATETIME or INTERVAL values, or between a DATE and a DATETIME value, expressed in years and months, or else in days and smaller units of time.

Character Data Types

4GL supports two simple data types for storing character strings. Each is designed for a different maximum length of the data string:

Char Strings of up to 32,767 characters. (The ANSI standard also recognizes the keyword CHARACTER for this data type.)

Varchar Strings of up to 255 characters, optionally reserving a definable number of bytes (up to 255) of storage space.

Structured Data Types

4GL supports two structured data types for storing sets of values:

Array Arrays of up to 32,767 values (in any of up to three dimensions) of any data type except ARRAY. (The limit on the total number of elements in an array is compiler-dependent.)

Record Sets of values of any data type, or any combination of types.

Large Data Types

These store pointers to binary large object (blob) values, up to 2**31 bytes in size (or to a limit imposed by your implementation of INFORMIX-OnLine):

Text Character strings.

Byte Anything that can be digitized and stored on your system.