Re: Regular Expressions and Standard COBOL (was Re: Use of Class conditions in COBOL)

"Karl Kiesel" <Karl.Kiesel@xxxxxxxxxxxxxxxxxxx> wrote in message
"Rick Smith" <ricksmith@xxxxxxx> schrieb im Newsbeitrag
My reference to "delimited strings" was historical; that is,
the common REs of today were developed using
variable-length, null-terminated (delimited) strings. Any use
of variable-length strings, today, continues that tradition.

COBOL data-items are not defined as variable-length,
except for the ANY LENGTH qualified items I mentioned.
Currently, COBOL data-items may be made variable-length,
programmatically, by using an OCCURS DEPENDING ON
phrase or by insertion of a delimiter; but the occurrence count
or delimiter used are separate data-items.

Using OO-language elements, ANY LENGTH items are already available in
STD2002! For a rough sketch, how regualar expressions could be made
available to a COBOL program without invoving any standardization
committees, see below.

Well, you made me take a closer look at ANY LENGTH
in both the current and draft standards! My statements, above,
are correct; though I don't understand why, in 2002, ANY
LENGTH can not be used in the linkage section of a program,
other than a contained program.

I wrote that, currently, a data-item may be made variable-length
by insertion of a delimiter. Under 2002, the source element
referencing an ANY LENGTH item must know what
delimiter (or other means) was used. Under the draft standard,
the delimiter is explicit by the DELIMITED phrase or defaults
to X"00" for pic X, or X"0000" for pic N. With this change,
the LENGTH function may be used to find the length of an
ANY LENGTH item. The 2002 standard leaves it to the
user to calculate the length. [The LENGTH function also now
works with ANY LENGTH PREFIXED items.] Thus,
under the draft standard ANY LENGTH items become true
variable-length items.

So, regular expressions could be implemented in COBOL 85.
They are less messy in COBOL 2002. And, as far as I can
tell, the draft standard removes the last wrinkles to developing
a class or functions for the processing of regular expressions,
as they are commonly understood.