DTRHELP.HLB  —  Commands Statements Clauses, BEGIN END Statement, Examples
       The following example shows how to store five records in the
       domain PHONES, each having LOCATION MB1-H2 and DEPARTMENT CE.
       The SET NO PROMPT command suppresses the "[Looking for . . .]"
       prompts preceding each CON> prompt. This example also shows how
       DEC DATATRIEVE responds to CTRL/C and CTRL/Z when it is prompting
       you for input.

       DTR> READY PHONES WRITE
       DTR> SET NO PROMPT
       DTR> REPEAT 5 STORE PHONES USING
       DTR> BEGIN
       CON>      NAME=       *.NAME
       CON>      NUMBER=     *.NUMBER
       CON>      LOCATION=   "MB1-H2"
       CON>      DEPARTMENT= "CE"
       CON> END
       Enter NAME: FRED
       Enter NUMBER: 555-1234
       Enter NAME: GERRY
       Enter NUMBER: <CTRL/C>
       ^C
       Enter NUMBER: <CTRL/Z>
       Execution terminated by operator
       DTR>

       The following example shows how to use a BEGIN-END block to put
       three statements in the USING clause of a MODIFY statement, print
       a YACHTS record, modify the price, and print the result of the
       modification:

       DTR> READY YACHTS WRITE
       DTR> SET NO PROMPT
       DTR> FOR YACHTS WITH PRICE = 0
       CON> MODIFY USING
       CON> BEGIN
       CON>          PRINT
       CON>          PRICE = *."NEW PRICE"
       CON>          PRINT
       CON> END

                                     LENGTH
                                      OVER
       MANUFACTURER  MODEL     RIG    ALL   WEIGHT BEAM  PRICE

        BLOCK I.    40         SLOOP   39    18,500  12
       Enter NEW PRICE: 30000

                                     LENGTH
                                      OVER
       MANUFACTURER  MODEL     RIG    ALL   WEIGHT BEAM  PRICE

        BLOCK I.    40         SLOOP   39    18,500  12  $30,000
        BUCCANEER   270        SLOOP   27     5,000  08
       Enter NEW PRICE: <CTRL/Z>
       Execution terminated by operator

       DTR>

       The following example shows how a BEGIN-END block is treated as a
       single statement:

       DTR> DEFINE PROCEDURE LOOP_EXAMPLE
       DFN> PRINT "SHOW HOW A BEGIN-END WORKS WITH REPEAT"
       DFN> PRINT "AND MORE THAN ONE STATEMENT"
       DFN> END_PROCEDURE
       DTR>
       DTR> REPEAT 2 :LOOP_EXAMPLE
       SHOW HOW A BEGIN-END WORKS WITH REPEAT
       SHOW HOW A BEGIN-END WORKS WITH REPEAT
       AND MORE THAN ONE STATEMENT

       DTR> REPEAT 2 BEGIN :LOOP_EXAMPLE; END
       SHOW HOW A BEGIN-END WORKS WITH REPEAT
       AND MORE THAN ONE STATEMENT
       SHOW HOW A BEGIN-END WORKS WITH REPEAT
       AND MORE THAN ONE STATEMENT

       DTR>
Close Help