palmtree with sun behind it CONTACT US
Phone: (412) 835-9417
Email: sales@vss3.com

Tip # 44 - Creating an Export file to share with Windows Software

As is often the case, data from filePro must be collected and written to a file that will be read by Windows Software of one kind or another.  To insure that the file is easily read, the record delimiters must be CR/LF or Hex: 0D0A.

If you are working on a Unix/Linux computer, the default (\n) delimiter will be a LF.  How do you add the CR to make it work?

Method 1:  Write the file with the command:

export ascii alias=filename r=\n f=,

then when the file has been generated, use a Unix utility to translate the end of record delimiters to CR/LF

xtod filename >filename.txt  (Unix only command)

Method 2: Write the file without any delimiters in the export.  Add what you need in the logic.

 5 ------- - - - - - - - - - - - - - - - -
wrtrec ◄ If: 'export ascii samples
Then: export ascii file=(filename) -x
6 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: file(1)=1{","{2{","{3{chr("10"){chr("13");write file;return
7 ------- - - - - - - - - - - - - - - - -

This would write the three fields of data, separated by commas and then a record delimiter CR/LF at the end of each record.  Quotes could also be added by inserting a variable such as QU(1)="\"" where ever you needed quotes

 5 ------- - - - - - - - - - - - - - - - -
wrtrec ◄ If: 'export ascii samples
Then: export ascii file=(filename) -x
6 ------- - - - - - - - - - - - - - - - -
◄ If:
Then: file(1)=qu{1{qu{","{qu{2{qu{","{qu{3{qu{chr("10"){chr("13");write file;return
7 ------- - - - - - - - - - - - - - - - -

Method 3:  If you really want to test the waters with filePro, I have also used the following crazy method to write a fixed width data structure.  Use the Report aspect of filePro, set up a print code table that has CR/LF as the linefeed marker and send the output to a file.

Smush out the headings and subtotals of the report and line up the data to the correct positions for the file structure required.  Send the output to a file and voila, you have a fixed length record with delimiters and all you have to work with is the report logic of a normal report.

Report layout might look like this:

*1    *2     *3

You can even put in commas if you want like this:

*1      , *2      , *3

For some types of requirements this is the easiest way to make something fast.

 

 

 

 

 


Written by Nancy Palmquist

Copyright, 1997 by Virtual Software Systems.  All rights reserved.

Contact Us by: Email to Virtual Software Systems or Phone: (412) 835-9417