DTRHELP.HLB  —  Commands Statements Clauses, WHILE Statement, Example
       The following example groups the boats with LOA less than 35
       according to the value of BEAM and displays the TYPE, LOA, and
       BEAM of the shortest boat from each group of boats with the same
       value for BEAM:

       DTR> SHOW WHILE_EX
       PROCEDURE WHILE_EX
       BEGIN
       DECLARE X PIC 99.
       X = 0
       FOR YACHTS WITH LOA < 35 AND
           BEAM NE 0 SORTED BY BEAM, LOA
           WHILE X < BEAM
           BEGIN
               PRINT TYPE, LOA, BEAM, X
               X = BEAM
           END
       END
       END_PROCEDURE

       DTR> :WHILE_EX

                               LENGTH
                                OVER
       MANUFACTURER   MODEL     ALL   BEAM X

       CAPE DORY    TYPHOON     19     06  00
       WINDPOWER    IMPULSE     16     07  06
       ERICSON      23/ SPECIA  23     08  07
       EASTWARD     HO          24     09  08
       ALBIN        79          26     10  09
       BOMBAY       CLIPPER     31     11  10
       IRWIN        25          25     12  11

       DTR>
Close Help