How do I force export from within a loop

John Esak john at valar.com
Wed Aug 17 10:09:41 PDT 2005


> 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.

However, I do put WRITE's inside of every getnext loop which is changing
data in the lookup file. It has solved a myriad of problems, and it hurts
nothing.

John Esak



More information about the Filepro-list mailing list