Re: Why COBOL is losing the POWER struggle
- From: "William M. Klein" <wmklein@xxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 25 Jun 2009 23:37:15 -0500
See my other note. Although INSPECT REPLACING doesn't do what you want,
UNSTRING, INSPECT/REPLACING (or even MOVE) followed by STRING would do it.
Or as your original note indicated, a PERFORM loop would also do it.
--
Bill Klein
wmklein <at> ix.netcom.com
"Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:7aaojaF1v66vqU1@xxxxxxxxxxxxxxxxxxxxx
docdwarf@xxxxxxxxx wrote:
In article <7a886lF1s84o2U1@xxxxxxxxxxxxxxxxxx>,
Pete Dashwood <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
[snip]
I wanted my buffer replaced in situ as a string. The ONLY reason I
needed a second buffer was because INSPECT wasn't up to the task.
Wait, I am confused. The situ of 'DATE' is four bytes and 'DATETIME'
requires eight. To place in the situ of a four-character string an
eight-character one requires a... curious bit of mathematics, to say
the least.
Perhaps a more carefulreading would reveal that what I said was "my BUFFER
replaced in situ". There is plenty of room in the buffer for expansion of
individual bits of it.
[snip]
I am not now, and never was, discussing the fault of COBOL, or any
faults of COBOL. I posted a fact. That fact contributes to the
perception of POWER in the language.
Mr Dashwood, once again: what language has the POWER to fill startpos
8, len 4 with an eight-byte string without some sort of compression?
C#, Java, and Visual Basic ALL do it easily. The actual operand(s) is/are not
compressed; the buffer which it/they occurs in is not changed in length
either. A Regular Expression can expand or compress replacement operands
within a buffer. If it runs out of expansion space then the last part of what
the buffer contains is truncated accordingly; if the string it contains
becomes shorter, then it is padded with whatever character you designate
(space by default). And all of this requires ONE line of code. (Actually,
that is not even scratching the surface of what you can do with Regular
Expressions in ONE line of code, it is just a simple example... have a look
at: http://www.design215.com/toolbox/regexp.php THAT is powerful.
If INSPECT ...REPLACING could do that it would be more powerful than it is.
Sure, the non-English-like syntax of Regex strings looks weird and unfamiliar
to COBOL people (It was devised by a mathematician and there is a mathematical
simplicity and elegance to it once you start to understand it), but there is
no denying the POWER of it...
Pete.
--
"I used to write COBOL...now I can do anything."
.
- Follow-Ups:
- Re: Why COBOL is losing the POWER struggle
- From: Howard Brazee
- Re: Why COBOL is losing the POWER struggle
- References:
- Why COBOL is losing the POWER struggle
- From: Pete Dashwood
- Re: Why COBOL is losing the POWER struggle
- From: Pete Dashwood
- Re: Why COBOL is losing the POWER struggle
- From: riplin
- Re: Why COBOL is losing the POWER struggle
- From: Pete Dashwood
- Re: Why COBOL is losing the POWER struggle
- From:
- Re: Why COBOL is losing the POWER struggle
- From: Pete Dashwood
- Why COBOL is losing the POWER struggle
- Prev by Date: Re: Why COBOL is losing the POWER struggle
- Next by Date: Re: Why COBOL is losing the POWER struggle
- Previous by thread: Re: Why COBOL is losing the POWER struggle
- Next by thread: Re: Why COBOL is losing the POWER struggle
- Index(es):
Relevant Pages
|