Export fixed length

Kenneth Brody KandLBrody at gmail.com
Wed Aug 10 15:03:45 PDT 2011


On 8/10/2011 5:06 PM, Mike Schwartz wrote:
>> Trying to create an export (fixed length) using following syntax:
>>
>> export ascii ach=/appl/fpmerge/achtest.txt -X r=\n
>>
>> then do all my field assignments, etc
>>
>> ach(1)=1;ach(2)=2...etc
>>
>> When the file is created it's not adding a line feed after each record?
>>
>> I have tried with and without the r=\n ??
>>
>> When looking at the output file, it just lists the records one after the
> other
>>
>> i.e.  file looks like:
>>
>> 627065400153        45496004627314074269     104280298
>>                                             ^ new record should start here
>>
>> Should look like:
>>
>> 627065400153        45496004
>> 627314074269        104280298
>>
>> Why is it not adding the line feed?
>>
>> Thanks for any insight
>>
>> Scott
>
>       With the -X option, as I recall, you have to add your own carriage
> return/linefeed (or whatever you want to terminate each record with)
> yourself.
>
>       For example, you need a line like:
>
> ach(10)=chr("13") {chr("10")
>
>       at the end of the fields you are writing, if you want a DOS formatted
> file.

Note that, on Windows, that will get you a double-spaced file.  And, on 
*nix, this will give you a file with a spurious Ctrl-M at the end of each 
line.  All you want is CHR("10").

However, you shouldn't need that at all, as the following works just fine 
for me:

==========
   Then: export ascii foo = /temp/foo.txt r=\n -x
   Then: foo[1] = 1
   Then: foo[2] = 2
   Then: foo[3] = 3
==========

This gives me the following output:

==========
Brody               Ken                 11/17/2009
smith               john                11/21/2009
obama               barack              06/21/2010
smith               john                06/21/2010
==========

-- 
Kenneth Brody


More information about the Filepro-list mailing list