
As we mentioned at the start of this section, a Control procedure can be used to manage almost every element of DataEase, performing tasks such as combining menus, input forms, procedures, conditional actions, and output into fully automated business applications.
A Control procedure can be used to:
Execute any DataEase menu option from within the procedure. In this respect, Control procedures are similar to chain menus. However, Control procedures let you combine DQL conditional logic with the chain menu processing capabilities.
Link DQL Procedures together and execute them automatically.
Pass values among procedures.
Now, we'll demonstrate how Club ParaDEASE can link the preceding procedures together to automate the entire process for entering and posting reservations, calculating reservation discounts, and printing reservation invoices. To link the procedures, you must create a new script that combines the two Processing procedures into a Control procedure.
The script for this Control procedure is listed immediately below. Following the script, the purpose of each line in the Control procedure is explained.
The Control procedure script contains only five lines:
define global "DISCOUNT" Number .
define global "RESTOTAL" Number .
define global "RESERVATION#" Number.
run procedure "INPUT RESERVATIONS" .
run procedure "CALCULATE DISCOUNTS" .
The first three lines of the Control procedure define the global variables that are used in procedures 2 and 3:
define global "DISCOUNT" Number .
define global "RESTOTAL" Number .
define global "RESERVATION #" Number .
To pass a global variable from one procedure to another, the variable must be defined identically in each procedure that uses it as well as the main Control procedure. A global variable can be assigned a value just once, and used by each individual procedure, or manipulated and reassigned in one or more procedures. The variables defined in this control procedure don't have values assigned to them until the CALCULATE DISCOUNTS procedure begins processing.
The fourth line of the Control procedure specifies:
run procedure "INPUT RESERVATIONS" .
The run procedure command executes a procedure just as if you chose File>>Open to run a procedure. When DataEase reaches the end of the procedure, the next command is automatically executed in the Control procedure.
When the INPUT RESERVATIONS procedure is run, DataEase creates a new record in the RESERVATIONS form for each new reservation, copying the information from the TEMPMEM temporary holding form. Finally, the number of rooms required for the new reservation are subtracted from the VACANCIES field in the CLUB ROOMS form.
The fifth line specifies:
run procedure "CALCULATE DISCOUNTS" .
This command executes the CALCULATE DISCOUNTS procedure that: (1) calculates the total dollar amount of the reservation, (2)calculates the total number of children and adults included in the reservation, and (3) calculates the dollar amount of the discount to be applied to the cost of the reservation.
The third procedure, RESERVATION INVOICES is called from within the CALCULATE DISCOUNTS procedure so RESERVATION INVOICES is not included in the control procedure. Since the define and run procedure commands do not require any special terminating command other than a period, no further commands are required.
Product: DataEase for Windows 7.x. Written by George Washington 11/04/14 at 08:26:17
Product: DataEase 8 Reporter. Written by eduardo paez 02/05/14 at 14:40:11
Product: . Written by Marco Marchesi 15/02/16 at 14:50:46
Product: . Written by Grossi Gioacchino 18/11/19 at 14:33:44
Product: Dataease [{8}]FIVE. Written by Rainer 22/03/21 at 11:13:10
Product: Dataease [{8}]FIVE. Written by Rainer 08/06/21 at 14:12:40