123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
- <sect1 id="Actions_and_Attributes">
- <title>Actions and Definitions</title>
- <para>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.</para>
- <sect2 id="Functions_as_ActionsFunctions_as_Actions">
- <title>Expressions as Actions<indexterm>
- <primary>Expressions as Actions</primary>
- </indexterm></title>
- <para>Fundamentally, any expression in can be treated as an Action. For
- example,</para>
- <programlisting>Attr1 := COUNT(Trades);
- Attr2 := MAX(Trades,trd_bal);
- Attr3 := IF (1 = 0, 'A', 'B');</programlisting>
- <para>are all definitions, but without a definition name, they are simply
- expressions</para>
- <programlisting>COUNT(Trades); //execute these expressions as Actions
- MAX(Trades,trd_bal);
- IF (1 = 0, 'A', 'B');</programlisting>
- <para>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.</para>
- </sect2>
- <sect2 id="Attributes_as_ActionsAttributes_as_Actions">
- <title>Definitions as Actions<indexterm>
- <primary>Definitions as Actions</primary>
- </indexterm></title>
- <para>These same expression definitions can be executed by submitting the
- names of the Definitions as queries, like this:</para>
- <programlisting>Attr1; //These all generate the same result values
- Attr2; // as the previous examples
- Attr3;</programlisting>
- </sect2>
- <sect2 id="Actions_as_Attributes">
- <title>Actions as Definitions<indexterm>
- <primary>Actions as Definitions</primary>
- </indexterm></title>
- <para>Conversely, by simply giving any Action a Definition name it becomes
- a definition, therefore no longer a directly executable action. For
- example,</para>
- <programlisting>OUTPUT(Person);</programlisting>
- <para>is an action, but</para>
- <programlisting>Attr4 := OUTPUT(Person);</programlisting>
- <para>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:</para>
- <programlisting>Attr4; // run the previously defined OUTPUT(Person) action </programlisting>
- </sect2>
- <sect2 id="Debugging_Uses">
- <title>Debugging Uses</title>
- <para>This technique of directly executing a Definition as an Action is
- useful when debugging complex ECL code. You can send the Definition as a
- query to determine if intermediate values are correctly calculated before
- continuing on with more complex code.</para>
- </sect2>
- </sect1>
|