Type
Procedural Command

Purpose
Like the if command, the while command executes a series of actions based on whether a specified condition is true. Unlike the if command, the while command creates a processing loop in which actions are executed repeatedly as long as the specified condition remains true.
When processing reaches a while command, DataEase evaluates the condition that follows the keyword while. If the specified condition is true, DataEase executes all the actions that follow the keyword do until it reaches the corresponding end command.
DataEase then reevalutes the original condition. If the condition is still true, DataEase executes the do action series again. If the condition is false, processing passes to the first action following the end command for the while statement.

Syntax
while CONDITION do
ACTION 1 .
[ACTION 2 .
.
.
ACTION N .]
end

Usage
Frequently, a while command specifies an initial condition that is modified during each pass through the loop (for example, a counter). Any action that modifies the value to be reevaluated must be included in the loop (i.e., it must precede the end command that terminates the loop.)

Example
define temp "CRUISE TICKET NUM" Number .
assign temp CRUISE TICKET NUM := 0 .

while temp CRUISE TICKET NUM < 1000 do
temp CRUISE TICKET NUM := temp CRUISE TICKET NUM + 1 .
list records
jointext ( " Boarding Pass No.: " ,
temp CRUISE TICKET NUM) .
end

This script tells DataEase: (1) Create (define) a temporary variable called CRUISE TICKET NUM, (2) give (assign) an initial value of 0 to the CRUISE TICKET NUM variable, (3) print a series of labels joining the words Boarding Pass No.: to the number currently stored in the CRUISE TICKET NUM variable, (4) while printing the labels, increment the variable by one each time a new label is printed, and (5) when the value of the variable reaches 1000, stop printing labels.
The while command tells DataEase to reevaluate the value of the variable each time it prints a label. As long as that value is less than 1000, DataEase prints another label. When the value of the variable reaches 1000, DataEase stops performing the action following the do keyword.