Implementing Execution Models in the Model
A model should include code to implement the required processing for a given execution mode.
This code can be conditionally executed by placing in a procedure and registering the procedure as the handler for the execution mode. A procedure that immediately follows the definition of the execution mode in the source is registered as the handler for that execution mode.
The procedure
insightdispatch should be called to invoke the handler for the current mode:
!@insight.execmodes.MYMODE procedure mymodeHandler insightpopulate …. end-procedure insightdispatchAs an alternative to the automatic dispatching with insightdispatch, a developer can manually invoke the appropriate code conditional on insightgetmode.
procedure mymodeHandler insightpopulate …. end-procedure case insightgetmode of “MYMODE”: do mymodeHandler exit(0) end-do end-case