[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Foxpro!!!



>    Thanks for your reply. I have the script writing to a file and
>formating OK
>but, I'm not to sure about the formating you always see at the top of the txt
>file from the database.
>
>"\
>t
>YTDPURCH
>
>The biggest problem right now is getting the database guy to send me a mock-up
>file. Do you or anybody know what all this crap is? I can see that it
>obviously
>names the fields but, how will all this affect my script.

What you are looking at is NOT the text format of the data, but the native
Foxpro file format, which does include a record-layout header.  However (I'm
speaking from experience here, having done lots of this), if your database
designer will give you a description of the required data, you can write a
plain ASCII text file which can be APPENDed to an existing datafile without
your having to deal with the Foxpro-dependent header.  For example, if the
description were something like:

   Each record contains a 5-digit account number, a date in mmddyy format,
   a currency amount between -9999.99 and 99999.99, and a 25-character
   description.

all you'd need to do is output plain text using something like

   printf TXTOUT "%05d\t%06d\t%8.2f\t%-25.25s\n", $acct, $dtmdy, $amt, $desc;

(assuming suitable variable contents, of course).

A TRIVIAL Foxpro program could simply inquire for the text file generated as
above, and append the contents of the file to the database (one record per
line of text, fields tab-delimited, etc. ad tedium).

-----------------------------------------------------------------------
-jn-                                         (personal opinion du jour)
-----------------------------------------------------------------------