This shouldn't be a problem if your using " to flip a "QuoteOn" flag.

"field ""description"" here"

first quote would trigger the flag on
the first double quote would trigger the flag off, then on again
the second doub quote would trigger the flag off, then on again
the last quote would trigger the flag off

So if you encounter a @FM while the flag is on, it's not the end of a line
if you encounter a @FM while the flag is off it's most like the end of a line, 

It usually happens when the input is entered via a text box, and someone hits 
the <ENTER>
key to drop to a next line, instead of just typing and letting it wrap.

George Gallen
Senior Programmer/Analyst
Accounting/Data Division
[email protected]
ph:856.848.9005 Ext 220
The Wyanoke Group
http://www.wyanokegroup.com
________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Symeon Breen 
[[email protected]]
Sent: Thursday, May 26, 2011 3:26 AM
To: 'U2 Users List'
Subject: Re: [U2] [UD] Extract a line with a CR and/or LF character in it.

Thats the way i process csv, because of the cr/lf issue but also you can
have double set of quotes inside a quoted field and of course have commas
inside as well  e.g. ,"field ""description,"" here", so you can not always
just split on " or ,

Another alternative is to preprocess the csv using the linux tr command.



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Bill Haskett
Sent: 26 May 2011 07:58
To: U2 Users List
Subject: Re: [U2] [UD] Extract a line with a CR and/or LF character in it.

I figured out how to do this.  I read each line and use a subroutine to
go through each character.  It sets a variable 'QuoteOn' if we're in a
quoted string.  Obviously if the line ends while in a quoted string, the
next line belongs to the current line.  Man, what a pain this was!  :-)

Thanks for your thoughts and help.

Bill

------------------------------------------------------------------------
----- Original Message -----
*From:* [email protected]
*To:* [email protected]
*Date:* 5/25/2011 10:13 PM
*Subject:* Re: [U2] [UD] Extract a line with a CR and/or LF character in
it.
> It's been a while - but I'm pretty sure that OSBREAD keeps the CR/LF as
part of the block (you may need to put NO CONVERT ON in the code). READSEQ
automatically ends at the CR/LF so you would have to "put the lines
together" if you were short fields.
>
> In both cases it would mean going through the block/line a character at a
time to parse out each field. Of course, to work with embedded quotes and
commas you pretty much have to any way. With READSEQ you know the line ended
on a CRLF - you just need to figure out if it's the end of the record or
not.
>
> Does that make more sense?
>
> Hht
> Colin Alfke
> Calgary, Canada
>
>
>> From: wphaskett
>>
>> 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

_______________________________________________
U2-Users mailing list
[email protected]
http://listserver.u2ug.org/mailman/listinfo/u2-users
-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1375 / Virus Database: 1509/3659 - Release Date: 05/25/11

_______________________________________________
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

Reply via email to