DTRHELP.HLB  —  Commands Statements Clauses, Restructure Statement, Examples
       The following example defines a new domain using FAMILY_REC
       and stores only those records of families that have no children
       younger than 15:

       DTR> DEFINE DOMAIN NEWFAMS USING FAMILY_REC ON FAMS;
       DTR> DEFINE FILE FOR NEWFAMS MAX, KEY = MOTHER (DUP)
       DTR> NEWFAMS = FAMILIES WITH NOT ANY KIDS WITH AGE LE 15
       DTR> FIND NEWFAMS
       [8 records found]
       DTR> FIND FAMILIES
       [16 records found]
       DTR>

       The following example defines a new domain called YACHTS_PRICE_
       LIST, which contains only the fields TYPE and PRICE from the old
       YACHT record definition. The number of records transferred is
       checked with the FIND statement and the accuracy of the transfer
       is checked with the CROSS statement. The example displays some
       of the records from the new domain to check the presence of the
       MISSING VALUE edit string.

       DTR> DEFINE DOMAIN YACHTS_PRICE_LIST USING YPL_REC ON YPL.DAT;
       DTR> DEFINE RECORD YPL_REC USING
       DFN> 01 BOAT.
       DFN>    03 TYPE.
       DFN>       05 BUILDER PIC X(10).
       DFN>       05 MODEL PIC X(8).
       DFN>    03 PRICE PIC 9(5) MISSING VALUE IS 0
       DFN>       EDIT_STRING $$$,$$$?"NOT LISTED".
       DFN> ;
       [Record is 23 bytes long.]
       DTR> DEFINE FILE FOR YACHTS_PRICE_LIST KEY = TYPE
       DTR> READY YACHTS_PRICE_LIST AS YPL WRITE
       DTR> READY YACHTS
       DTR> SHOW READY
       Ready domains:
          YACHTS:  Domain, RMS indexed, protected read
                  <CDD$TOP.DTR32.WAJ.YACHTS;1>
          YPL:  Domain, RMS indexed, protected write
                  <CDD$TOP.DTR32.WAJ.YACHTS_PRICE_LIST;1>
       No loaded tables.

       DTR> YPL = YACHTS WITH LOA GT 35
       DTR> FIND YACHTS WITH LOA GT 35
       [23 records found]
       DTR> FIND YPL
       [23 records found]
       DTR> FIND A IN YPL CROSS B IN YACHTS OVER
       [Looking for field name]
       CON> TYPE WITH A.PRICE NE B.PRICE
       [0 records found]
       DTR> FIND YPL WITH PRICE MISSING
       [12 records found]
       DTR> PRINT FIRST 3 CURRENT

        BUILDER    MODEL     PRICE

       BLOCK I.   40       NOT LISTED
       CABOT      36       NOT LISTED
       DOWN EAST  38       NOT LISTED

       DTR>

       The following example uses the Restructure statement to transfer
       data from an indexed file to a sequential file:

       DTR> SET NO PROMPT
       DTR> READY YACHTS AS OLD
       DTR> DEFINE FILE FOR YACHTS
       DTR> READY YACHTS AS NEW WRITE
       DTR> NEW = OLD
       DTR> FIND NEW
       [113 records found]
       DTR>

       If the field has a DEFAULT VALUE clause, DEC DATATRIEVE
       initializes the field with the default value. If the field has a
       MISSING VALUE clause and no DEFAULT VALUE clause, DEC DATATRIEVE
       initializes the field with the missing value. If the field has
       neither a DEFAULT VALUE clause nor a MISSING VALUE clause, DEC
       DATATRIEVE initializes a numeric field as 0 and an alphabetic or
       alphanumeric field as spaces.
Close Help