Skip to main content


Each ECL definition is the basic building block of ECL. A definition specifies what is done but not how it is to be done. Definitions can be thought of as a highly developed form of macro-substitution, making each succeeding definition more and more highly leveraged upon the work that has gone before. This results in extremely efficient query construction.

All definitions take the form:

[Scope] [ValueType] Name [ (parms) ] := Expression [ :WorkflowService] ;

The Definition Operator ( := read as "is defined as") defines an expression. On the left side of the operator is an optional Scope (see Attribute Visibility), ValueType (see Value Types), and any parameters (parms) it may take (see Functions (Parameter Passing)). On the right side is the expression that produces the result and optionally a colon (:) and a comma-delimited list of WorkflowServices (see Workflow Services). A definition must be explicitly terminated with a semi-colon (;). The Definition name can be used in subsequent definitions:

MyFirstDefinition := 5; //defined as 5
MySecondDefinition := MyFirstDefinition + 5; //this is 10

Definition Name Rules

Definition names begin with a letter and may contain only letters, numbers, or underscores (_).

My_First_Definition1 := 5; // valid name
My First Definition := 5;  // INVALID name, spaces not allowed

You may name a Definition with the name of a previously created module in the ECL Repository, if the attribute is defined with an explicit ValueType.

Reserved Words

ECL keywords, built-in functions and their options are reserved words, but they are generally reserved only in the context within which they are valid for use. Even in that context, you may use reserved words as field or definition names, provided you explicitly disambiguate them, as in this example:

ds2 := DEDUP(ds, ds.all, ALL); //ds.all is the 'all' field in the
                               //ds dataset - not DEDUP's ALL option

However, it is still a good idea to avoid using ECL keywords as definition or field names.

Definition or field names cannot begin with UNICODE_ , UTF8_, or VARUNICODE_. Labels beginning with those prefixes are treated as type names, and should be regarded as reserved.

Definition Naming

Use descriptive names for all EXPORTed and SHARED Definitions. This will make your code more readable. The naming convention adopted throughout the ECL documentation and training courses is as follows:

Definition Type     Are Named
Boolean              Is...
Set Definition       Set...
Record Set           ...DatasetName

For example:

IsTrue := TRUE;                         // a BOOLEAN Definition
SetNumbers := [1,2,3,4,5];              // a Set Definition
R_People := People(firstname[1] = 'R'); // a Record Set Definition