Perhaps you could document what you mean by "horrible.".
I did in the next sentence. All table access in any COBOL I've touched is horrible compared to most other languages. This counts the list that you mentioned, which is the standard dogma that works for COBOL. COBOL (both mainframe and PC) just doesn't handle tables well.
Let me relate to you another example of mine, which has nothing to do with STRING, UNSTRING and INSPECT, but still has something to do with table access. I got to playing around in some downtime when I was working with coding different sorts in COBOL and testing their execution time on the mainframe (IBM COBOL for this and that, etc).
I found something curious, though. The sorts that, by traditional wisdom are the fastest (like quicksort), were actually quite slow within COBOL. I found this quite interesting, so I tested the algorithms further by counting different operations, and discovered something. The fastest algorithm, Combsort (3X faster in fact!), is the one that touches the table the least. And yes I was using indexes on all things. And yes, PC COBOL is just as consistent - you would think they would try to use the same algorithmic techniques that are used in the PC compilers where quicksort actually is the fastest.
Your code fails if the input string contains an "*", or whatever other character you might use for a marker.
Any byte can be used there without a problem, even non-printable characters which would never appear in a standard text string. Not a problem with what was posted.
Both of these statements have very high overhead, much more than referance modification could have.
Are you judging by what you think is happening by reading the source, or actually learning what's happening behind the scenes? Have you tested these things to see? Behind the scenes, STRING UNSTRING and INSPECT do things much more efficiently in most cases than what can be done in COBOL.
Like I mentioned, this thread involves much simpler things than the case I found where going to those things in a program reduced the execution time by half. But I did test what was posted in this thread (as copied, no modifications) before I made my assertion on a copy of Fujitsu COBOL 3.0, by throwing a large number of text strings at them. Want to take a guess which one was faster? Hint: It wasn't what TLeaders posted.
Measurement is not management.