DO WHILE as needed from the source tables SELECT SQL for the partial info I need in Table1 COPY TO Text1 TYPE DELIMTED SELECT SQL for the partial info I need in Table2 COPY TO Text2 TYPE DELIMTED SELECT SQL for the partial info I need in Table3 COPY TO Text3 TYPE DELIMTED Append the 3 files in a memo field IN IMPORT ENDDO CLOSE DATA ALL USE Import COPY MEMO Temp TO MyFile.TxtThis worked perfecty but was much too slow for the large quantities I had to process. So I had to find another method.
CREATE CURSOR OUTPUT (ASCI C(254)) && each ASCII line is approx. 150 caracters SELECT * FROM INVOICE ; WHERE INVOICE.DATE BETWEEN m.BEG_DATE AND m.END_DATE ; ORDER BY INVOICE.INV_NUM INTO CURSOR TMP SCAN * Prepare variable to contain the filtered/converted information * The Header information of the Invoice prepared 'by hand' in ASCII format INSERT INTO OUTPUT FROM MEMVAR SELECT INV_ITEMS NB_LINES=0 SCAN FOR TMP.INV_NUM=INV_ITEMS.INV_NUM * Get, prepare and converts informations for each line of invoice INSERT INTO OUTPUT FROM MEMVAR NB_LINES=NB_LINES+1 ENDSCAN * prepare ending line for this invoice ASCI='"E","'+ALLTRIM(STR(m.NB_LINES))+'"' INSERT INTO OUTPUT FROM MEMVAR ENDSCAN SELECT OUTPUT COPY TO final.txt DELIMITED WITH BLANKThis method is very fast.