× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



On Thu, 2009-10-15 at 14:20 -0500, jmmckee wrote:
I have received a file from an outside agency that chokes CPYFRMIMPF. The fields are pipe delimited. I have looked at the raw file and don't see anything REALLY obvious - the file is several hundred lines long. I can open this thing in Excel just fine, but there is no option to save it with pipe delimiters. There is a free text portion, which, I suspect, prompted the need to use the pipe as a delimiter.

The agency has converted this file multiple times, and the results are the same. Other files are just fine. When I attempted to use an error file, I got nothing in the created member.

Is this why some of you loathe CPYFRMIMPF? Any suggestions on how to isolate and fix the error(s) causing CPYFRMIMPF to choke? Not sure I have the time to write the program to split this thing apart. Can SQL be used in some way to identify or clean up the file?

John,

At a guess, you might look for lines with the wrong number of fields. I
suspect that a newline in the free text portion might show up as a
following line with just one field.

If for example, you expect three fields in each record, you can use the
regular expression '^([^|]*\|){2}[^|]*$'. Here you see the results from
a test in qshell against lines with three, four, and two fields.

$
echo 'field one|field two|anudder one' | grep -E '^([^|]*\|){2}[^|]*$'
field one|field two|anudder one
$
echo 'field one|field two|anudder one|' | grep -E '^([^|]*\|){2}[^|]*$'
$
echo 'field one|field two nudder one' | grep -E '^([^|]*\|){2}[^|]*$'

Cheers,
Terry.


John McKee


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.