Action main function
Action main function
This is the main entry point for the action.
---------------------------------------------------------------------------
-- Action Entry Point
---------------------------------------------------------------------------
CREATE FUNCTION Main() RETURNS BOOLEAN
ACTION: BEGIN
Pseudo constants initialization
Check and initialize any pseudo constants that are required.
-----------------------------
-- Action Initialization Code
-----------------------------
IF NOT PSEUDO_CONST_INIT THEN
CALL InitPseudoConstants();
END IF;
Action begin
Perform any additional action initialization, or any action code that is applicable to all transitioning objects, that is required before the action loop. For example, you might need to extract context information from the event or look up some value that will be common to all affected objects. You seldom will need to do anything here.
-----------------------------------
-- Action Init : Begin
-----------------------------------
-- TODO <insert your esql here>
-- for example Declarations, init, etc
-----------------------------------
-- Action Init : End
-----------------------------------
Action loop
Actions are carried out for an object whose state is transitioning. The action loop iterates through the objects that are transitioning and executes action code on each object. This is usually where most of the customized action code is located.
--------------------------------------------------
-- OBJ_ITER loop runs for each object transitioned
--------------------------------------------------
OBJ_ITER: WHILE LASTMOVE(rObj) DO
-------------------------------
-- Action Object : Begin
-------------------------------
-- this provides diagnostic information in the Env in the event of an Exception
SET rPMPVars.CURRENT_ID = rObj.ID; -- TODO tailor rObj.ID to your object selector
-- TODO <insert your esql here>
-------------------------------
-- Action Object : End
-------------------------------
-- Go on to the next object
MOVE rObj NEXTSIBLING REPEAT NAME;
END WHILE OBJ_ITER;
Action end
This performs any action finalization and cleans up any action code that is applicable to all transitioning objects that is required after the action loop. For example, you might need to clean the environment tree entries. You seldom will need to do anything here.
-----------------------------------
-- Action Finalize : Begin
-----------------------------------
-- TODO <insert your esql here>
-----------------------------------
-- Action Finalize : End
-----------------------------------