[comp.databases] dBASE III+ problem

cbsoth@brl-tbd.ARPA (Cliff B. Sothoron ) (11/06/87)

I recently was refused tech support from Ashton-Tate because my 90 
day tech support had expired a month before. I ask a dBASE question
about once every two years. It is a very obnoxious policy by Ashton-Tate
to require registered users who paid large dollars(for PC software at
least) to pay out even more just to get quick help. Federal users like
myself have lead times of six months before anything can be purchased.
Therefore I am forced to bother the world with my problem. 
FLAME OFF

I would like to prompt a user in a .prg file with a sequence similar to
this:

datab='test.dbf'
@ 2,2 say 'What database do you wish to access' get datab
read
use 'datab'

The sequence above does not work. The file test.dbf is assumed to exist.
If it does not I know that I can always use the FILE() command mentioned
in volume 2 of the dBASE manual. Does anyone know what I have to do to
get dBASE to use a database name input via a memory variable?

FLAME ON
Are you listening Ashton-Tate? Or are you too busy sueing the proposed
standards committee?
FLAME OFF

                 Thanks in advance,


Clifton B. Sothoron Jr.
Ballistic Research Laboratory
Aberdeen Proving Grounds, Md.
cbsoth@brl

dBASE is a registered trademark of Ashton-Tate Inc.

esr@beach.cis.ufl.edu (Edward Roepe) (11/06/87)

Try the following:

  STORE SPACE(8) TO DBNAME
  @5,10 SAY "Enter Database Name" GET DBNAME
  READ
  USE &DBNAME

From the book:

  Expert dbase III+
  Judd Robbins and Ken Braly
  Page: 79

marla@upba.UUCP (11/06/87)

	I tried to mail directly, but you weren't in our path alias file.

> I would like to prompt a user in a .prg file with a sequence similar to
> this:

> datab='test.dbf'
> @ 2,2 say 'What database do you wish to access' get datab
> read
> use 'datab'

> The sequence above does not work. The file test.dbf is assumed to exist.

> Clifton B. Sothoron Jr.

	I've used this solution:

MNAME='test'
USE &MNAME

	I haven't ever tried the prompt, but I assume this would work:

datab='test'
@ 2,2 say 'What database do you wish to access' get datab
read
use &datab

	


UUCP:   ...!ihnp4!upba!marla                            Marla Conway

BOB_PROF_LAKE@cup.portal.com (11/08/87)

In message 190@brl-tbd.ARPA, Cliff B. Sothoron posts:
>
>I would like to prompt a user in a .prg file with a sequence similar to
>this:
>
>datab='test.dbf'
>@ 2,2 say 'What database do you wish to access' get datab
>read
>use 'datab'
>
>The sequence above does not work. The file test.dbf is assumed to exist.
>If it does not I know that I can always use the FILE() command mentioned
>in volume 2 of the dBASE manual. Does anyone know what I have to do to
>get dBASE to use a database name input via a memory variable?

I think what you need here is a macro.  You really want to substitute
the contents of the variable 'datab' for the name of the file.

Instead of:
                use 'datab'
try:
                use &datab

This has worked for me (you may have to fiddle a little with the
extension, etc.)


===============================================================================
|           Robert C. Lake             |     VOICE: (205) 271-9581 (Work)     |
|         School of Business           |     VOICE: (205) 279-8185 (Home)     |
|   Auburn University at Montgomery    |           CIS: [71216,560]           |
|        Montgomery, AL 36116          |      "Viva la papillon Venus!"       |
|-----------------------------------------------------------------------------|
|                             rcl@cup.portal.com                              |
|     {ucbvax,decwrl,decvax,seismo,hplabs}!sun!portal!cup.portal.com!rcl      |
===============================================================================
|       Opinions expressed above are solely my own -- not my employer's       |
===============================================================================

pt0o+@andrew.cmu.edu (Percival Tieng) (11/12/87)

 I know there has been a lot of replies to this problem and I would like to
toss in 
my hat and give my fair share...

One of the solutions proposed was from E.Roepe:

  STORE SPACE(8) TO DBNAME
  @5,10 SAY "Enter Database Name" GET DBNAME
  READ
  USE &DBNAME
 
What I would like to add is the fact that when you use the command:

	STORE SPACE(8) TO DBNAME

you are actually limiting the input space to 8 characters.  

This might pose problems when you have to specify paths or even 
drive specifications.  The same is true when you say 

	datab='test.dbf'

A better way is to assign an arbitrary length to the character variable
datab.

	STORE SPACE(10) TO DATAB   && if we allow different drive specs

or even

	STORE SPACE(20) TO DATAB   && to allow for subdirectories

If you wish to assign a default as in datab = 'test.dbf':
use:

	STORE 'test.dbf' + SPACE(12) TO DATAB

space(12) to set the length of datab to 20.

To store an arbritrary filename ( maybe assigned as default earlier in the
program )
to a character variable ( which we want to retain as having a length of 20 ),

	STORE LEFT( deffilename + space(20), 20 ) TO DATAB

where deffilename may be of any length.  

Hope this all helps...