In this section: |
You can use Dialogue Manager commands to manage the execution of a procedure. The commands used for this purpose are -RUN, -EXIT, -QUIT, and -QUIT FOCUS.
You can execute stacked commands and continue the procedure with the -RUN command.
The -RUN command causes immediate execution of all stacked commands and closes any external files opened with -READ or -WRITE. Following execution of the stacked commands, processing of the procedure continues with the line that follows -RUN.
The following illustrates the use of -RUN to execute stacked code and then return to the procedure. The numbers to the left correspond to the notes explaining the code.
1. TABLE FILE SALES PRINT PROD_CODE UNIT_SOLD BY CITY END 2. -RUN TABLE FILE EMPLOYEE PRINT LAST_NAME FIRST_NAME BY DEPARTMENT END
The procedure processes as follows:
You can execute stacked commands and then exit a procedure with the -EXIT command. -EXIT forces the execution of stacked commands as soon as it is encountered.
In the following, the first report request or the second report request will execute, but not both.
1. -SET &PROC = 'SALES' 2. -IF &PROC EQ 'EMPLOYEE' GOTO EMPLOYEE; -SALES 3. TABLE FILE SALES SUM UNIT_SOLD BY PROD_CODE END 4. -EXIT -EMPLOYEE TABLE FILE EMPLOYEE PRINT LAST_NAME BY DEPARTMENT END
The procedure processes as follows:
If the value for &PROC had been EMPLOYEE, control would pass to -EMPLOYEE.
The request under the label -EMPLOYEE is not executed.
This example also illustrates an implicit exit. If the value of &PROC was EMPLOYEE, control would pass to the label -EMPLOYEE after the -IF test, and the procedure would never encounter -EXIT. The TABLE FILE EMPLOYEE request would execute and the procedure would automatically terminate.
How to: |
You can cancel the execution of a procedure with the -QUIT command. -QUIT cancels execution of any stacked commands and causes an immediate exit from the procedure. Control returns directly to the WebFOCUS application regardless of whether the procedure was called by another procedure. This command is useful if tests or computations generate results that make additional processing unnecessary.
-QUIT
-QUIT FOCUS [n]
where:
Is the operating system return code number. It can be a constant or variable. A variable should be an integer. If you do not supply a value or if you supply a non-integer value, a default return code is posted to the operating system, indicating abnormal termination.
A major function of user-controlled return codes is to detect processing problems. The return code value determines whether to continue or terminate processing. This is particularly useful for batch processing.
The following example illustrates the use of -QUIT to cancel execution based on the results of an -IF test:
1. -DEFAULT &CODE='B11'; 2. -IF &CODE EQ '0' OR &CODE EQ 'DONE' GOTO QUIT; 3. TABLE FILE SALES SUM UNIT_SOLD WHERE PROD_CODE EQ &CODE END 4. -QUIT
The procedure processes as follows: