While Definitions define expressions that may be evaluated, Actions trigger execution of a workunit that produces results that may be viewed. An Action may evaluate Definitions to produce its result. There are a number of built-in Actions in ECL (such as OUTPUT), and any expression (without a Definition name) is implicitly treated as an Action to produce the result of the expression.
Fundamentally, any expression in can be treated as an Action. For example,
Attr1 := COUNT(Trades); Attr2 := MAX(Trades,trd_bal); Attr3 := IF (1 = 0, 'A', 'B');
are all definitions, but without a definition name, they are simply expressions
COUNT(Trades); //execute these expressions as Actions MAX(Trades,trd_bal); IF (1 = 0, 'A', 'B');
that are treated as actions, and as such, can directly generate result values by simply submitting them as queries to the supercomputer. Basically, any ECL expression can be used as an Action to instigate a workunit.
These same expression definitions can be executed by submitting the names of the Definitions as queries, like this:
Attr1; //These all generate the same result values Attr2; // as the previous examples Attr3;
Conversely, by simply giving any Action a Definition name it becomes a definition, therefore no longer a directly executable action. For example,
is an action, but
Attr4 := OUTPUT(Person);
is a definition and does not immediately execute when submitted as part of a query. To execute the action inherent in the definition, you must execute the Definition name you've given to the Action, like this:
Attr4; // run the previously defined OUTPUT(Person) action