home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / database / sri314_b.zip / DEMOPRGS.ZIP / RELATION.PRG < prev    next >
Text File  |  1990-09-30  |  1KB  |  39 lines

  1. **********************************************************************
  2. *  RELATION.PRG
  3. **  (C) Copyright 1990, Sub Rosa Publishing Inc.
  4. **  A demonstration program provided to SR-Info and VP-Info users.
  5. **  This program may be copied freely. If it is used in commercial code,
  6. **  please credit the source, Sub Rosa Publishing Inc.
  7. **
  8. **  RELATION.PRG demonstrates use of two related data files and the
  9. **  FIND command
  10. **  
  11. **  MASTRAN and CUSTLIST are both indexed on the customer number.
  12. **  A record is found in MASTRAN by having the user enter a customer
  13. **  number into FINDER.  If a matching record is found, # will equal
  14. **  :NEAR, but if not, the program positions on :NEAR, the first record
  15. **  greater than the FIND key.
  16. **  
  17. **  During BROWSE, every time a new record is shown, the matching
  18. **  record in CUSTLIST is shown as well and, if changed, updates 
  19. **  the contents of CUSTLIST.
  20. **********************************************************************
  21. SET talk off
  22. USE mastran index mastran
  23. USE#2 custlist index custlist
  24. SET relation on cust_no to 2
  25. DO WHILE t
  26.    CLS
  27.    ACCEPT 'Enter a customer number (leave blank to quit). . . ' to finder
  28.    IF finder=' '
  29.       BREAK
  30.    ENDIF
  31.    FIND &finder
  32.    IF #<>:NEAR              ;:NEAR equals record number if successful
  33.       GOTO :NEAR
  34.    ENDIF
  35.    BROWSE cust_no,amount,dayout,cust_no#2,fname#2,name#2,address#2,city#2
  36. ENDDO
  37. *
  38. *                 *** end of program RELATION.PRG ***
  39.