[comp.databases] text files from DBASE

GR.AGC@isumvs.iastate.edu (Gene Collins) (04/09/90)

In the following article Aaron David Herskowitz writes:
>From: aaronh@ms.uky.edu (Aaron David Herskowitz)
>Subject: Writing dBase III+ Data to Files
>
>Would anyone here know how to "redirect" data from dBase III+ to a
>file?
>
>I have some data in a database that I would like to put into a text
>file so that I can use it in conjunction with a mail merge.
>
>Any suggestions/comments would be greatly appreciated...
>
>--
>Aaron Herskowitz   <=========> University of Kentucky: Unix Lab Consultant,
>aaronh@ms.uky.edu     _kai_    Student Government Computer Systems Manager


There are two ways of extracting text data from DBASE.  The first is by
using the copy command as follows:

.USE <DATABASE_FILE_NAME>
.COPY TO <TEXT_FILE_NAME> {SDF|DELIMITED WITH DELIMITER} [FOR CONDITION]

The "SDF" option will give you a file with a ".TXT" extension, having fixed
length fields (padded with spaces) butted one against another with no
separating delimiters.  The "DELIMITED WITH" option will give you a text
file which has fields separated with the specified delimiting character.
The optional "FOR" clause restricts the records copied to those which
match the specified conditions.

The second way of producing text files is by using the set alternate
command as follows:

.USE <DATABASE_FILE_NAME>
.SET ALTERNATE TO <TEXT_FILE_NAME>
.SET ALTERNATE ON
. <COMMANDS TO CAUSE RECORDS TO PRINT ON SCREEN>
.SET ALTERNATE OFF

The above sequence will cause DBASE to capture any information printed on
the screen to the specified text file.  The set alternate off command
closes the text file.

Hope this helps.

Gene Collins, Microcomputer Consultant
Iowa State University
GR.AGC@ISUMVS.BITNET

Disclaimer: "Views or opinions expressed are my own, and do not constitute
the opinions or views of Iowa State University!"