I guess that's my problem. I can't use OSBREAD because the Cr/Lf
appears in different columns in the line. I can't guarantee where it
shows up (or what character position). Using READSEQ doesn't work
either because the line read by the statement is only a part of the
entire line in the file! e.g.
0,4300,1BEU,Robert,Smith,Julie,Smith,1 Lakewood Dr,,63031,"1 Lakewood Dr
San Diego, CA 92122",,,$150.00,,,,,
0,4300,1CYN,John Randolph,Bones,,,1 Round Ct,,63031,"1 Round Ct
San Diego, CA 92122",,,$150.00,,,,,
...when the lines should look like (only two lines):
0,4300,1BEU,Robert,Smith,Julie,Smith,1 Lakewood Dr,,63031,"1 Lakewood
Dr, San Diego, CA 92122",,,$150.00,,,,,
0,4300,1CYN,John Randolph,Bones,,,1 Round Ct,,63031,"1 Round Ct, San
Diego, CA 92122",,,$150.00,,,,,
There's no guarantee the field causing the problem will even have any
data in it, so I can't append every 2nd line to the end of every 1st
line. :-(
Once I get the line I can deal with each character at a time. Any other
ideas?
As always, thanks.
Bill
------------------------------------------------------------------------
----- Original Message -----
*From:* [email protected]
*To:* [email protected]
*Date:* 5/25/2011 9:20 PM
*Subject:* Re: [U2] [UD] Extract a line with a CR and/or LF character in
it.
For text files I like to use openseq and readseq. With embedded CR/LF's (which
are actually valid in a csv file) you would have to see if you needed to put
the lines back together. There were a couple of examples of reading csv files a
while back in CDP.
The other alternative is to use osopen and osbread. This will read a block of
text (size of your choosing and I've found you have to play a bit to get good
throughput). You then have to parse through the block literally character by
character.
hth
Colin Alfke
Calgary, Canada
From: wphaskett
I've received some import files (csv) that use either a CR and/or LF
character in a test field (surrounded by "-marks). It seems to be
somebody's idea of multi-value. However, I'm having a hard time
extracting them (dynamic length lines) because UD considers it a
field-mark. Therefore, the REMOVE() function, READSEQ statements don't
work (a single line is considered two lines), and FORMLIST/READNEXT
don't work because the key is too long for a select list.
Anyone know how to extract a line of a simple csv file that contains a
CR and/or LF within the line?
Thanks,
Bill Haskett
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users