How do I force export from within a loop

Brian K. White brian at aljex.com
Wed Aug 17 13:56:08 PDT 2005


----- Original Message ----- 
From: "John Esak" <john at valar.com>
To: "filePro mailing list" <filepro-list at seaslug.org>
Sent: Wednesday, August 17, 2005 1:09 PM
Subject: RE: How do I force export from within a loop


>> I have a routine that prints the letters using FilePro and the "FORM"
>> command to force output but have not found a command to force "export "
>> within a getnext loop.
>> ----------------------------------
>>
>>      I know John Esak already explained that you can do this by passing
>> through the export line once for each record you want written, but here 
>> is
>> another method:
>>
>>      Once you open the export file, you can use the "write"
>> command to write
>> a single line to it.  For example, if you open an export file
>> with an alias
>> like "lout = lettersout.csv", inside your loop, put the statement "write
>> lout" inside your loop at any point where you want to write a new line to
>> the lettersout.csv file.
>>
>>      I can send you a sample bit of code that shows how to do this, if 
>> you
>> still can't figure it out.  Otherwise, Stuart Werner has a full
>> example and
>> explanation on page 381 of the 4th edition of his filePro training 
>> manual.
>> (I think he has explained this in all previous versions of his book, as
>> well...)
>>
>> Mike Schwartz
>
> Mike,
>
> This is not correct. If Stuart has explained it that way in his book, no
> matter how many times he's reprinted it, he's still wrong. A WRITE will in
> no way export a line to an export file. Unless, the EXPORT line itself is
> within the loop (getnext or any other kind of loop which gets successive
> records) nothing will be added to the export file. So, unless you mean
> something else, or Stuart explained it some other way, this is just not
> correct.
>
> You could put the EXPORT *and* a WRITE inside a loop and export successive
> records, but it still won't be the WRITE that does the exporting... It 
> will
> only ensure an immediate in-line write, that's all.

Sure it will. As long as you allow that he might have meant write().

Looking up the page in the stn book that he referenced would have shown if 
he was talking about the file i/o write() command, which might have avoided 
falsely accusing both Mike and Stuart of being wrong. I don't have that book 
handy so I can't say that he was talking about the file i/o command or the 
commit-lookup-now command.

Do you do have the book, and did you look up the referenced page, and find 
that it talks about the write command that commits lookups and not the file 
i/o command?

And even if it _did_, since he also said "I have proven code I can show 
you", it's kind of dumb to say "that's wrong" before saying "show me".

Brian K. White  --  brian at aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro  BBx    Linux  SCO  FreeBSD    #callahans  Satriani  Filk!



More information about the Filepro-list mailing list