home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / misc1 / db-comm.lzh / DOC next >
Encoding:
Text File  |  1986-10-15  |  2.3 KB  |  87 lines

  1.  
  2. DBASE III+ to com port interface
  3. by C.R. Weber
  4. 10/86
  5.  
  6. Included here is an example database and interface routines to allow
  7. DBASE  III+ to communicate through the Com ports.
  8.  
  9. This program works with Tcomm.  This is only a first try and all
  10. commants and sugested improvements will be greatly appreciated.
  11.  
  12. I uset a batch file to make this work from the program section of tcomm.
  13. Here is what it contained:
  14.  
  15. cd /db/appl
  16. dbase tmarc
  17.  
  18.  
  19. dbase.exe and dbase.ovl (and any other required files) must be in this
  20. directory or you may use a utility like dpath to allow dbase to
  21. find its overlays in any directory.  Thats what I do.
  22.  
  23. NOTE: These routines will only work on DBASE III+ (PLUS).  DBASE III
  24.     has no way of calling external assembly routines.  DBASE II
  25.     appears to use near calls.
  26.  
  27. To send a string to the com port a dbase string variable must be assembled
  28. (numbers must be displayed bye using the str() function) in the dbase
  29. procedure and then sent to the outport routine.
  30.  
  31. Input from the port can be a single character or a line.  The max number of
  32. characters to be received is the length of the dbase string sent to inport.
  33. You must initialize the dbase string to the proper length before calling
  34. inport.
  35.  
  36.  
  37. An example of how to use these routines follows:
  38.  
  39. nl = chr(13)+chr(10)
  40. LOAD inport                <- Dbase loads Assembly routines
  41. LOAD outport
  42.  
  43. CLOSE PROCEDURE
  44. SET PROCEDURE TO tm_proc
  45.  
  46. menu_ok = .t.
  47. DO WHILE menu_ok
  48.                     <- Assemble the output string
  49.     msg = nl+nl+nl+;
  50.         "               Welcome to the TMARC Database"+nl+nl+;
  51.         "    1 - List Database"+nl+;
  52.         "    2 - Input Records"+nl
  53.     CALL outport WITH msg
  54.     msg =     "    3 - Update Record"+nl+;
  55.         "    0 - Exit"+nl+nl+;
  56.         "Enter your selection: "
  57.     CALL outport with msg        <-- send the string
  58.     len = 1
  59.     ans = space(2)            <-- init dbase string to two characters
  60.     CALL inport with ans        <-- get no more than two characters
  61.     DO CASE
  62.  
  63.     CASE ans = "1"
  64.         DO tm_list     WITH "nd_tmarc INDEX nd_tmnum"
  65.  
  66.     CASE ans = "2"
  67.         DO tm_input     WITH "nd_tmarc INDEX nd_tmnum"
  68.  
  69.     CASE ans = "3"
  70.         DO tm_upd     WITH "nd_tmarc INDEX nd_tmnum"        
  71.  
  72.     CASE ans = "0"
  73.         menu_ok = .f.
  74.  
  75.     OTHERWISE
  76.         msg = nl+"Please enter only 0 thru 3"    <-- assemble new message
  77.  
  78.     ENDCASE
  79.         
  80. ENDDO
  81. DISP memory                <-- debug only
  82.  
  83. CLOSE PROCEDURE
  84. RETURN
  85.  
  86.  
  87.