ADELIA |
VADELIA |
SADELIA |
WADELIA |
MADELIA |
(I/B) |
(I/B) (C/S) |
(B) (S) |
(I/B) (C/S) |
(I) (C/S) |
Section for use
All
Syntax
DO_WHILE Condition
Description
This instruction evaluates conditions. This evaluation may itself be composed of several conditions.
It marks the beginning of the processing block which is executed as long as the condition is true.
The syntax of the condition is the same as the one of the IF instruction.
The logical operators are: =, >, <, >=, <=, <>, START_WITH, CONTAINS, BETWEEN, EXISTS, DOES_NOT_EXIST, NOT.
Additionally, with VADELIA and SADELIA programs, you can use arithmetic or concatenation expressions in the left and right factors of logical operators (arithmetic operators take precedence over logical operators).
If the expressed condition does not apply, the program continues to the instruction following the associated REDO instruction.
If the expressed condition applies, all the instructions which follow will be executed until the associated REDO instruction is reached, at which point a return to the DO_WHILE instruction occurs.
Every DO_WHILE instruction must have a corresponding REDO instruction.
Note: It is possible to nest DO_WHILE instructions up to 100 levels.
Example
a) Simple expression:
*
READ_EQUAL ORDERS
DO_WHILE CODE START_WITH 'S'
PRINT_VIEWS LINE_FORMAT
READ_EQUAL ORDERS
REDO
b) Complex expression:
*
DO_WHILE CODE = 'S' AND ( EMPLOY_CATEGORY > 300 OR PAY_TYPE = 'D' )
TOTAL_AMOUNT = TOTAL_AMOUNT + ( SALARY_AMNT * 12 )
TOTAL_DAYS = TOTAL_DAYS + EMPLOYEE_DAYS
REDO
c) Condition using nested loops:
*
POSITION_BEFORE ORDER_HEADING
DO_WHILE ORDER_HEADING EXISTS
PRINT_VIEWS HEADER
*
POSITION_BEFORE ORDER_DETAIL
DO_WHILE ORDER_DETAIL EXISTS
PRINT_VIEWS DETAIL
READ_EQUAL ORDER_DETAIL
REDO
*
READ_EQUAL ORDER_HEADING
REDO