Re: Cobol Linear search Vs Perfrom Until

From: Frederico Fonseca (real-email-in-msg-spam_at_email.com)
Date: 07/18/04


Date: Sun, 18 Jul 2004 10:06:21 +0100

On Sun, 18 Jul 2004 03:37:38 GMT, robert.deletethis@wagner.net (Robert
Wagner) wrote:

>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.
Pretty, but not portable. This implies that the compiler used allows
for ESQL. Not all do.

There is at lease one that does not support without third party tools,
and even like that it needs a preprocessor from whatever DB they have
available (which at this stage are Oracle, SYBASE, DB2 and ADABAS. SQL
server does not have it, neither does MySQL.).

The above code also implies a connection to a DB, which may not be
required throughout the application, so the overhead of adding just
for a "conversion" would void any speed/functionality gained by this.

Frederico Fonseca
ema il: frederico_fonseca at syssoft-int.com