Code Comments
Programming Forum and web based access to our favorite programming groups.On 23 Sep 2004 11:00:00 GMT, l.willms@jpberlin.de (Lueko Willms) wrote: >. Am 22.09.04 >schrieb robert@wagner.net.yourmammaharvests (Robert Wagner) > auf /COMP/LANG/COBOL > in vst1l01fre1nu9dq6tvkh7pbsshpebjlem@4ax.com > ueber Re: If you were inventing CoBOL... > > >RW> Parse-CSV-Row. >RW> move 1 to CSV-Pointer >RW> perform until CSV-Pointer greater than length(CSV-Row) >RW> move spaces to Next-Token > > move zero to item-number > >RW> if CSV-Row (CSV-Pointer:1) = '"' or "'" >RW> add 1 to CSV-Pointer >RW> unstring CSV-Row >RW> delimited by CSV-Row(CSV-Pointer-1:1) > >*> I would change "Next-Token" to a table item: > >RW> into Next-Token > into CSV-item(item-number) > >*> and add TALLYING: > TALLYING IN item-number Your two suggestions are in conflict. Occurs Depending On cannot be used on table items. >RW> with pointer CSV-Pointer >RW> unstring CSV-Row delimited by ', ' or ',' >RW> into trash with pointer CSV-Pointer >RW> else >RW> unstring CSV-Row >RW> delimited by ', ' or ',' > into CSV-item(item-number) > tallying in item-number >RW> with pointer CSV-Pointer >RW> end-if >RW> end-perform. > > Also, the delimiter should be made into a variable "CSV-delimiter" >e.g., so that it can be set to comma, semikolon, TAB, US, or whatever. > > I also think one should use someting like > > INSPECT CSV-item[CSV-Pointer] > TALLYING CSV-Pointer FOR LEADING SPACES CSV-delimiter > > to skip over the leading spaces of each item. Good for leading spaces, but I don't want to discard delimiters. > Wouldn't it be possible to implement this as an object CLASS? Yes. In that case, we're discussing code inside the unpack method.
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.