Dialogue Manager Processing

You can modify your application at run time with user input and environment conditions by using Dialogue Manager procedures, which include commands and variables. It is important to understand how Dialogue Manager processes commands and variables of an application, using a procedure.

Dialogue Manager executes a procedure as follows:

  1. Dialogue Manager reads each line of the procedure one by one, and substitutes values for variables when encountered.

    You must make sure to assign values or identify defaults for all variables. Otherwise, you will receive an error message indicating a missing value.

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

    Other WebFOCUS commands are temporarily stored for subsequent execution, which are called stacked commands.

  3. The -RUN and -EXIT commands execute any stacked commands.

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



Example: A Procedure and Its Execution Process

The following is an example of a procedure, with an explanation of the way it processes.

The procedure contains the variable &PLANT. Assume that when the procedure executes it includes the variable value of BOS for &PLANT. The numbers on the left correspond to the notes explaining the code.

1. -IF &PLANT EQ 'DONE' THEN GOTO GETOUT;
 
2. TABLE FILE CENTHR
   HEADING
    "SALARY REPORT FOR LOCATION: &PLANT"
   PRINT SALARY POSITION
   BY LNAME
   WHERE PLANT IS '&PLANT'
   END
 
3. -RUN
 
4. -EXIT
 
   -GETOUT
   -TYPE NO PROCESSING DONE: EXITING

The procedure processes as follows:

  1. The values for &PLANT is passed to the procedure before the first line executes. This can be done by entering values in the HTML interface, or by setting the values previously with other Dialogue Manager commands. Dialogue Manager substitutes the value BOS for the variable &PLANT in the first line, and tests for the value DONE. The test fails, so Dialogue Manager proceeds to the next line.

    If the value were DONE instead of BOS, control would pass to the label -GETOUT, and the message NO PROCESSING DONE: EXITING would be generated. Dialogue Manager would skip the report request.

  2. The next six lines are the report request. Dialogue Manager scans them for the presence of variables, substituting BOS for &PLANT. As each line is processed, it is placed on a stack to be executed later.

    After Dialogue Manager processes the END command, the stacked commands look like this:

    TABLE FILE CENTHR
    HEADING
    "SALARY REPORT FOR LOCATION: BOS"
    PRINT SALARY POSITION
    BY LNAME
    WHERE PLANT IS 'BOS'
    END

    The next line is then processed by Dialogue Manager.

    To display populated variable values like those contained in this step, include the &ECHO variable in your procedure. For information on the &ECHO variable, see Testing and Debugging a Dialogue Manager Procedure.

  3. -RUN causes the stacked commands to be executed. They are sent to be processed.
  4. -EXIT terminates the procedure.

For complete information on using variables in procedures, see Customizing a Procedure With Variables.