DTRHELP.HLB  —  Commands Statements Clauses, REPEAT Statement
       Causes DEC DATATRIEVE to execute a simple or compound DEC
       DATATRIEVE statement a specified number of times.

       Format

         REPEAT  value-expression  statement

1  –  Arguments

    value-expression

       Is a value expression indicating the number of times to execute
       the statement. This argument must evaluate to a positive integer
       less than or equal to 2,147,483,647.

    statement

       Is any simple or compound DEC DATATRIEVE statement (except a
       FIND, SELECT, DROP, or SORT statement).

2  –  Examples

       The following example prints TEST REPEAT three times:

       DTR> REPEAT 3 PRINT "TEST REPEAT"
       TEST REPEAT
       TEST REPEAT
       TEST REPEAT

       DTR>

       The following example aborts a REPEAT statement by responding to
       a prompt with a CTRL/Z:

       DTR> READY YACHTS WRITE
       DTR> REPEAT 5 STORE YACHTS
       Enter MANUFACTURER: HOBIE
       Enter MODEL: CAT
       Enter RIG: SLOOP
       Enter LENGTH-OVER-ALL: 22
       Enter DISPLACEMENT:  4000
       Enter BEAM: 8
       Enter PRICE: 6500
       Enter MANUFACTURER: <CTRL/Z>
       Execution terminated by operator
       DTR> FIND YACHTS WITH BUILDER = "HOBIE"
       [1 record found]
       DTR>

       The following example shows the effect of nesting REPEAT
       statements in procedures. The procedure NUM1 contains two PRINT
       statements. The procedure NUM2 contains two REPEAT statements,
       one nested in the other. The inner REPEAT statement causes
       DEC DATATRIEVE to execute the first PRINT statement in NUM1
       twice each time DEC DATATRIEVE loops through the outer REPEAT
       statement:

       DTR> SET NO PROMPT
       DTR> SHOW NUM1
       PRINT SKIP, "ONE, TWO, THREE"
       PRINT "ONE, TWO, THREE, FOUR, FIVE"

       DTR> :NUM1

       ONE, TWO, THREE

       ONE, TWO, THREE, FOUR, FIVE

       DTR> SHOW NUM2
       REPEAT 2
            BEGIN
               REPEAT 2 :NUM1
            END
       :NUM1

       DTR> :NUM2

       ONE, TWO, THREE

       ONE, TWO, THREE
       ONE, TWO, THREE, FOUR, FIVE

       ONE, TWO, THREE

       ONE, TWO, THREE
       ONE, TWO, THREE, FOUR, FIVE

       ONE, TWO, THREE
       ONE, TWO, THREE, FOUR, FIVE

       DTR>
Close Help