Dialogue Manager Processing

Modify your application at run time with user input and environment conditions by using Dialogue Manager stored procedures, which include commands and variables.

In the FOCUS community, stored procedures are often referred to as FOCEXECs. In this document they are referred to as procedures.

The following diagram illustrates how a Dialogue Manager procedure is processed.

  1. Processing begins from the command processor when a procedure is invoked for execution at the FOCUS prompt (for example, EX SLRPT).
  2. The FOCEXEC Processor reads each line of the procedure. Any variables on the line are assigned the current values.
  3. If a variable is missing a value, FOCUS issues a prompt. The user then supplies the missing value.

    All Dialogue Manager commands execute as soon as Dialogue Manager reads them.

  4. When a command line containing no Dialogue Manager commands is fully expanded with any variables resolved (through either a -SET command or prompting), it is placed onto the command execution stack (FOCSTACK).
  5. Dialogue Manager execution commands (for example, -RUN) and statistical variables flush the FOCSTACK and route all currently stacked commands to the FOCUS Command Processor.

By the time your FOCSTACK is ready for execution, this has happened:

For an illustration, see Processing a Procedure, where the FOCUS Command Processor routes execution to the TABLE module and executes the TABLE request that was stacked.

Note: Any FOCUS command can be placed in a procedure, including the EXEC command. When an EXEC command is processed in a procedure, the commands from the new procedure are first stacked and then executed.

Example: Processing a Procedure

The following example traces the execution process of a procedure. The numbers at the left refer to explanatory notes that follow the example.

1. -TOP 
2. -PROMPT &WHICHCITY.ENTER NAME OF CITY OR DONE. 
3. -IF &WHICHCITY EQ 'DONE' GOTO QUIT; 
4. TABLE FILE SALES
   SUM UNIT_SOLD
   BY PROD_CODE
   IF CITY IS &WHICHCITY
   END 
5. -RUN 
6. -GOTO TOP 
7. -QUIT

Assume this procedure is stored in a file named SLRPT. To execute it, the user types either of the following:

EXEC SLRPT

or

EX SLRPT

The following describes the individual steps of the procedure:

  1. -TOP

    This is a label, which serves as a target to which -IF ... GOTO or -GOTO commands transfer processing control. Labels call for no special processing, so control passes to the next command.

  2. -PROMPT &WHICHCITY.ENTER NAME OF CITY OR DONE.

    The prompt "ENTER NAME OF CITY OR DONE" appears on the terminal. Assume the user types "STAMFORD" and the variable value is stored for later use. Processing continues with the next line.

  3. -IF &WHICHCITY EQ 'DONE' GOTO QUIT;

    Had DONE been entered, control would pass to -QUIT at the bottom of the procedure. This would end processing, cause an immediate exit from this procedure, and return control to the FOCUS prompt. Since STAMFORD was entered, processing continues with the next line.

  4. TABLE FILE SALES
       .
       .
       .

    Without a leading hyphen, this is interpreted as a FOCUS command. Only Dialogue Manager commands execute immediately, so the next five lines are placed in the stack where FOCUS commands are kept until executed; this is referred to as FOCSTACK. Note that the value STAMFORD, entered in response to the prompt, is inserted into the FOCUS command line as the value for &WHICHCITY.

    At this point the FOCSTACK looks like:

    TABLE FILE SALES
    SUM UNIT_SOLD
    BY PROD_CODE
    IF CITY IS STAMFORD
    END

    Control passes to the next Dialogue Manager command.

  5. -RUN

    This command sends the stack to FOCUS, which executes the stored request and returns control to the next Dialogue Manager command.

  6. -GOTO TOP

    Control is now routed back to -TOP, thus establishing a loop. Execution continues from -TOP with the -PROMPT command.

  7. -QUIT

    This command is reached when the user types DONE in response to the prompt. The procedure is exited and the FOCUS prompt appears.


Information Builders