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.
All Dialogue Manager commands execute as soon as Dialogue Manager reads them.
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.
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:
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.
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.
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.
. . .
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.
This command sends the stack to FOCUS, which executes the stored request and returns control to the next Dialogue Manager command.
Control is now routed back to -TOP, thus establishing a loop. Execution continues from -TOP with the -PROMPT command.
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 |