
DBASE III+ to com port interface
by C.R. Weber
10/86

Included here is an example database and interface routines to allow
DBASE  III+ to communicate through the Com ports.

This program works with Tcomm.  This is only a first try and all
commants and sugested improvements will be greatly appreciated.

I uset a batch file to make this work from the program section of tcomm.
Here is what it contained:

cd /db/appl
dbase tmarc


dbase.exe and dbase.ovl (and any other required files) must be in this
directory or you may use a utility like dpath to allow dbase to
find its overlays in any directory.  Thats what I do.

NOTE: These routines will only work on DBASE III+ (PLUS).  DBASE III
	has no way of calling external assembly routines.  DBASE II
	appears to use near calls.

To send a string to the com port a dbase string variable must be assembled
(numbers must be displayed bye using the str() function) in the dbase
procedure and then sent to the outport routine.

Input from the port can be a single character or a line.  The max number of
characters to be received is the length of the dbase string sent to inport.
You must initialize the dbase string to the proper length before calling
inport.


An example of how to use these routines follows:

nl = chr(13)+chr(10)
LOAD inport				<- Dbase loads Assembly routines
LOAD outport

CLOSE PROCEDURE
SET PROCEDURE TO tm_proc

menu_ok = .t.
DO WHILE menu_ok
					<- Assemble the output string
	msg = nl+nl+nl+;
		"               Welcome to the TMARC Database"+nl+nl+;
		"    1 - List Database"+nl+;
		"    2 - Input Records"+nl
	CALL outport WITH msg
	msg = 	"    3 - Update Record"+nl+;
		"    0 - Exit"+nl+nl+;
		"Enter your selection: "
	CALL outport with msg		<-- send the string
	len = 1
	ans = space(2)			<-- init dbase string to two characters
	CALL inport with ans		<-- get no more than two characters
	DO CASE

	CASE ans = "1"
		DO tm_list 	WITH "nd_tmarc INDEX nd_tmnum"

	CASE ans = "2"
		DO tm_input 	WITH "nd_tmarc INDEX nd_tmnum"

	CASE ans = "3"
		DO tm_upd 	WITH "nd_tmarc INDEX nd_tmnum"		

	CASE ans = "0"
		menu_ok = .f.

	OTHERWISE
		msg = nl+"Please enter only 0 thru 3"	<-- assemble new message

	ENDCASE
		
ENDDO
DISP memory				<-- debug only

CLOSE PROCEDURE
RETURN


