Primitive types

Each EGL primitive type characterizes an area of memory. There are three kinds of primitive types: character, numeric and datetime.

At declaration time, you specify the primitive type that characterizes each of these values:

Other entities also have a primitive type:

Each primitive type is described on a separate page; and additional details are available on the pages that cover assignments, logical expressions, function invocations, and the call statement.

The sections that follow cover these subjects:

Primitive types at declaration time

Consider the following declarations:

  DataItem
    myItem CHAR(4)
  end
  Record mySerialRecordPart type serialRecord
    {
       fileName="myFile"
    }
    10 name CHAR(20);
    10 address;
      20 street01 CHAR(20);
      20 street02 CHAR(20);
  end

As shown, specify a primitive type when you declare these entities:

You may specify the primitive type of a substructured structure item like address. If you fail to specify the primitive type of such a structure item but you reference the structure item in your code, the product makes these assumptions:

Relative efficiency of different numeric types

EGL supports the types DECIMAL, NUM, NUMC, and PACF so you can work more easily with files and databases that are used by legacy applications. It is recommended that you use items of type BIN in new development or that you use an equivalent integer type (BIGINT, INT, or SMALLINT); calculations are most efficient with items of those types. You get the greatest efficiency by using items of type BIN, length 2, and no decimal places (the equivalent of type SMALLINT).

In calculations, assignments, and comparisons, items that are of type NUM and have no decimal places are more efficient than items that are of type NUM and have decimal places.

Calculations with items of types DECIMAL, NUM, NUMC, and PACF are equally efficient.

Related concepts
DataItem part
Record parts
References to variables and constants
Structure

Related reference
Assignments
BIN and the integer types
call
CHAR
DATE
DBCHAR
DECIMAL
Exception handling
FLOAT
Function invocations
HEX
INTERVAL
Items
Logical expressions
MBCHAR
MONEY
NUM
NUMC
Numeric expressions
Operators and precedence
PACF
SMALLFLOAT
SQL item properties
Text expressions
TIME
TIMESTAMP
UNICODE