Newsgroups: bit.listserv.dbase-l
Date:         Mon, 17 Aug 1992 10:11:01 U
              dialects" <DBASE-L@NMSUVM1.BITNET>
From:         Tom Scott <tom_scott@QMRELAY.MAIL.CORNELL.EDU>
Subject:      Re: COPY FROM
X-To:         DBASE-L%NMSUVM1.BITNET@CORNELLC.cit.cornell.edu

                       Subject:
                       RE>COPY FROM
I'm pretty unfamiliar with exchanging files and importing and exporting, and I
haven't been able to find out _anythhing_ about this problem. Is it possible to
import a file delimited by carriage returns? This is all in Dbase III+, and the
file I'd like to import is in WP 5.1, and the linelength is _way_ over anything
I can keep on one line.

I'd like to be able to write a macro to seperate all of my fields by a carriage
return... that's not a problem. The problem's are:

1) The format of my copy command... COPY FROM file TYPE DELIMITED WITH (what?)

2) How does the program know when the next record starts? _Hopefully_ it would
just fill all the fields of a record and then just skip to the next one. I
could ensure that would work.... _if_ that's what it would do.

Hope someone can come up with some ideas, and I appreciate your help.

Brett Bendickson
bbendick@ccit.arizona.edu
______________________________________________

This is simple---I've been doing this for three years, in FoxPro and WP 5.0
(but it should work the same way in dBase and WP 5.1).

o In Fox (or dBase), just issue the command:
      COPY TO C:\WP50\DOC\ADDRESS.TXT FIELDS .... DELIMITED

(By just specifying DELIMITED, it assumes the default of DELIMITED WITH
COMMAS.)

o Then I used to go out to DOS and run the WP CONVERT command.  I automated it
about 2 years ago by including it as a Fox command, using the DOS RUN (!)
command, like:
   !C:\WP50\CONVERT C:\WP50\DOC\ADDRESS.TXT C:\WP50\DOC\ADDRESS.SF 8 , {13}{10}
",{13}{10}

It's been awhile since I ran dBase III+, so I can't remember if it has a way of
issuing DOS commands from within the dBase environment.  If not, go out to DOS,
and run the CONVERT command that's included in WP.  The first part is obviously
the path and file names of the .EXE executable, the file to be converted and
the file to which is should be converted to.  The "8" in my Fox command line
refers to choice #8 (Mail Merge to WordPerfect Secondary Merge).  The comma is
in response to the next prompt in the Convert process (Field Delimiter).  The
next prompt is for Record Delimiter, which we put in the ASCII values for a CR
and a LF, within curly braces {13}{10}.  The quotation mark (") is in response
to the next prompt, which is what characters need to be stripped from the
converted file (NOTE:  This section didn't seem to work from the Fox command
line.  Quotes were retained in my converted file.  I just wrote a WP macro to
strip them out, though.)  The final {13}{10} is the CR and LF to finish the
conversion.

Now that I think about this, I can't remember the reason that there's a comma
after the quotes.  Maybe that's why the quotes aren't properly stripped out.
Hmmmm..... I'll have to experiment some more.  But hopefully, I've pointed you
in the right direction.  If dBase has a way of issuing DOS commands within
programs, go that route using the command syntax that I've specified.
Otherwise, use the WP CONVERT command, going through the equivalent steps that
I've outlined.  Good luck!!!  :-) :-) :-) :-) :-)

 From the desk of:
Tom Scott

 Cornell University

 Carpenter Hall Annex
 Phone: (607) 255-0966
 Tom_Scott@qmrelay.mail.cornell.edu
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU