Loop through fields in an import file?

Mike Schwartz mschw at athenet.net
Wed Feb 9 06:25:30 PST 2011


     Using filePro 5.0.14 on Linux, I am trying to import a pipe-delimited
text file that has 331 fields in it.  I'm writing the data into a filePro
file that has 331 fields that are laid out exactly like the import file.

 

     import ascii infile = (@pm) f=| r =\n

     

     lookup ofile = cust2   r=free  -n

 

     I'd prefer not to write 331 "ofile(1)=infile(1)" style statements, but
I can't think of a way to write a loop that will loop 331 times to write all
the import fields to the output file.

 

     I declared fcount(3,.0) = "1" and then wrote a loop that included
ofile(fcount)=infile(fcount), but filePro gave me a syntax error on that,
pointing to the "f" in infile(fcount).    

 

     I thought about importing each data record as one long string (ignoring
the pipes) and then parsing the string for pipes, but that's a lot of extra
work.

 

     Or, instead of using "import", I could also "open" the file  and use
readline to process the data, but I would still have to parse for the pipes.


 

    However, before I sit down and write a lot of complex code, is there
some simple 1-liner method to loop through and move these 331 fields into
the output file?

 

Thanks!

 

Mike Schwartz

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20110209/885918a2/attachment.html 


More information about the Filepro-list mailing list