OpenDX - Documentation
Full Contents QuickStart Guide User's Guide User's Reference
Previous Page Next Page Table of Contents Partial Table of Contents Index Search

10.8 Understanding the Script Execution Model

An execution model is applied to the constructs defined by the Data Explorer scripting language. This model consists of the environment structure that is maintained during function calls, the behavior associated with macro expansions, the scope rules used for locating the value associated with a variable, and the semantics associated with assignment statements and function calls.

Top-level Environment

All global assignment statements and initial function invocations occur in the top-level environment. This environment is special in that all assignment statements and function invocations initiated in this environment are always executed.

Function Execution

When either a macro or a module function is executed, a new dynamically scoped environment specific to that function call is created. Variables that correspond to the function's input and output formal parameters are created in this new environment. The variables corresponding to the output formal parameters are initialized to NULL. Those variables corresponding to the input formal parameters are initialized in the manner described in the preceding section. If an input and an output formal parameter both have the same name, then they share a single parameter and are initialized to the value passed as input when the function is called.

Macro Expansion

When the function being called is a macro, the macro is effectively expanded in-line after first constructing the necessary environment for its input and output parameters. This guarantees that the partial orderings defined by macros are maintained.

Variables Used in Macros

The Data Explorer allows you to use variables on both the left and right sides of a function assignment; that is, as both left-side and right-side.

Variables as Left-Side Values

All assignments in a macro's environment affect variables that are local to the macro. These variables, if they do not already exist, are created in the macro's environment when they are first used on the left-h stream being sent to Data Explorer. The file being included can contain both scripting language constructs and executive commands. This means an included file can, in turn, include other files.

There is currently a limit of 32 nested levels of inclusion, after which the include commands are ignored.

To include the file my.script, issue the following command:

include "my.script"

Prompts

@prompt and @cprompt
There are two at-sign (@) variables that you can set in the executive (or in a script) to customize the Data Explorer script prompt (@prompt) and continuation prompt (@cprompt). (The continuation prompt appears when you enter an incomplete command in the script environment. It indicates that you must complete the command before it can be acted upon.)

The default prompt and continuation prompt are dx> and > respectively.

The following example show how to set these variables. Note that this example shows the Data Explorer prompts as they would be displayed in the executive.

dx> @prompt = "DATA EXPLORER>";
DATA EXPLORER> @cprompt = "    more>";

If, after these commands, an incomplete statement was entered, Data Explorer would respond as follows:

DATA EXPLORER> a =
    more> 3 * 5;


Full Contents QuickStart Guide User's Guide User's Reference

[ OpenDX Home at IBM | OpenDX.org ]

./usr/share/doc/dx/html/pages/usrgu057.htm0000644000000000000000000002345710404427216017175 0ustar rootroot User's Guide - Understanding the Script Execution Model
OpenDX - Documentation
Full Contents QuickStart Guide User's Guide User's Reference