home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / pbase.zip / REALTY.PRG < prev    next >
Text File  |  1985-10-02  |  3KB  |  75 lines

  1. * REALTY.PRG (08-11.a)
  2. * usage: realty
  3.  
  4. SHOW 'REALTY test program'
  5. SWITCH TALK OFF
  6. RESET DATABASE
  7. RESET REPORT
  8. DROP VARIABLE ALL
  9.  
  10. * initialize database and tables
  11. CREATE DATABASE realty
  12. CREATE CURSOR 1 FOR realty
  13. USE CURSOR 1
  14. CREATE TABLE listing (listid NUMBER,addr CHAR(25),city CHAR(25),footage NUMBER,;
  15.   bedrooms NUMBER,baths NUMBER,lotsize NUMBER,corner CHAR(1),schools CHAR(1),;
  16.   price NUMBER)
  17.  
  18. CREATE TABLE descr (listid NUMBER,descr CHAR(80))
  19.  
  20. INSERT INTO listing (listid,addr,city,footage,bedrooms,baths,lotsize,corner,schools,price);
  21.   VALUES(103,'addr','city',2400,4,2.5,.75,'n','y',170000)
  22. INSERT INTO listing (listid,addr,city,footage,bedrooms,baths,lotsize,corner,schools,price);
  23.   VALUES(102,'addr','city',1550,3,2,.45,'n','y',140000)
  24. INSERT INTO listing (listid,addr,city,footage,bedrooms,baths,lotsize,corner,schools,price);
  25.   VALUES(101,'addr','city',1800,3,2,.5,'y','n',150000)
  26.  
  27. INSERT INTO descr (listid,descr) VALUES (101,'2-car garage; Fenced yard')
  28. INSERT INTO descr (listid,descr) VALUES (102,'New carpets/drapes')
  29. INSERT INTO descr (listid,descr) VALUES (103,'3-car garage; Fruit trees')
  30.  
  31. * print a residential listing status report
  32. ENTER hiprice PICTURE '#######.00' PROMPT 'Enter highest desireable price:'
  33. SELECT listing.listid,listing.addr,listing.city,listing.footage,listing.bedrooms,;
  34.   listing.baths,listing.lotsize,listing.corner,listing.schools,listing.price,;
  35.   descr.descr FROM listing,descr;
  36.   WHERE price<=&hiprice and listing.listid=descr.listid;
  37.   ORDER BY listing.listid
  38. DOREPORT
  39.   REPORT output
  40.     TO CONSOLE
  41.     END
  42.   REPORT PAGE HEADING
  43.    PRINT TAB 25 '************************'
  44.    PRINT TAB 25 '* Residential Listings *'
  45.    PRINT TAB 25 '*     Ceiling Price    *'
  46.    PRINT TAB 25 '*' TAB 31 hiprice PICTURE '$^^^,^^^.^^' '      *'
  47.    PRINT TAB 25 '************************'
  48.    PRINT SKIP '  Num City      Address                   Bedrm Baths Acres  Price' SKIP 2
  49.    END
  50.   REPORT HEADING BREAK AT listid
  51.     PRINT SKIP listid PICTURE '^^^^^' ' ' city PICTURE '^^^^^^^^^^';
  52.       TAB 17 addr TAB 43 bedrooms PICTURE '^^' TAB 49 baths PICTURE '^^';
  53.       TAB 55 lotsize PICTURE '^.^^' '   ' TAB 62 price PICTURE '$^^^,^^^.^^'
  54.     PRINT SKIP 'Comments:'
  55.     IF corner='y'
  56.       PRINT 'CORNER LOT'
  57.       ENDIF
  58.     IF schools='y'
  59.       PRINT 'NEAR SCHOOLS'
  60.       ENDIF
  61.     END
  62.   REPORT PAGE DETAIL
  63.     IF descr <> ''
  64.       PRINT descr
  65.       ENDIF
  66.     END
  67.   REPORT FOOTING BREAK AT listid
  68.     PRINT SKIP 2
  69.     END
  70.   ENDREPORT
  71. DROP CURSOR 1
  72. DROP VARIABLE ALL
  73. DROP DATABASE realty
  74. SWITCH DEFAULT
  75.