On 26/05/11 13:26, Rex Gozar wrote: > For any CSV processing, you must process character by character. Use > OSBREAD to get a block of characters and start parsing. Strings like > 1,ABC,"2"" adapter",, can only be correctly parsed by looking at each > character and applying the simple CSV rules. Using CONVERT statements > only makes the process more complex and inaccurate.
IF you can handle the entire file as one string in memory, try using MATPARSE on it! You'll need the two-dimensional, multi-delimiter version but it could be very effective - look for comma, quote and newline. Actually, you don't need the entire file, just read it line by line. If it's got an odd number of quotes you know it's incomplete so you can read and concatenate the next line, then process the line when it's complete. MATPARSE is one of my war stories :-) A supervisor wrote a parser that was some five pages of printout, iirc. And it was buggy. I looked at it, used MATPARSE, and rewrote it in about ten lines! Cheers, Wol _______________________________________________ U2-Users mailing list [email protected] http://listserver.u2ug.org/mailman/listinfo/u2-users
