Re: Cobol Linear search Vs Perfrom Until

From: Robert Wagner (robert.deletethis_at_wagner.net)
Date: 07/18/04


Date: Sun, 18 Jul 2004 03:37:38 GMT

LX-i <lxi0007@netscape.net> wrote:

>Personally, I think INSPECT's hands are tied because the REPLACING
>targets have to be of the same size (at least that's how it is on the
>compiler I use daily). I'd like it to behave more like the VB "Replace"
>verb, where I could replace x"31" by "" and shrink up the rest of the
>data, or replace ">" with "&gt;" and have the data expand. Instead, I
>had to write my own looping algorithm for that - no big deal. Once it
>was written, it was done. :)

You coulda done it with one line of code by thinking outside the box:

EXEC SQL SELECT REPLACE (:my-string, '>', '&gt') INTO :my-string FROM DUAL
END-EXEC.