Operating System - OpenVMS
1755237 Members
4563 Online
108831 Solutions
New Discussion юеВ

EDT and string size in the substitute command

 
George Tjionas
Occasional Contributor

EDT and string size in the substitute command

It looks like EDT has a limit in the substitute command buffer (or maybe in other commands)

*sub/old_string/very-very-long-string/whole

gives "Invalid string" when the line is probably around 80 chars long or longer (I did not counted the characters - just a guestimate). It worked OK when I shortened teh string while playing with it.

Is there anyway to make it work with longer strings?

Thanks,

George
5 REPLIES 5
Jon Pinkley
Honored Contributor

Re: EDT and string size in the substitute command

It looks like you have discoved a case where TPU/EVE is better than EDT.

As John Gillings said in a another thread, EDT is frozen, and won't be fixed.

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1148390

EDT has some other limitations, for example 255 characters per line.

That being said, I still use EDT for a lot of things, but use EVE as well.

The corresponding command to EDT's s/string1/string2/wh in EVE is global replace.

Is there some reason you can't use EVE for this task?

Jon
it depends
Hein van den Heuvel
Honored Contributor

Re: EDT and string size in the substitute command

I think the limit it 64 bytes

Just a guess after reading...
EDT$$T_SUB_STR : BLOCK [CH$ALLOCATION (64)], ! Last SUBSTITUTE string.

:-).

Now personally I find it rather inconvenient to type in substitute string over say 39 bytes.
Anything larger for me is often a cut&paste job or automated procedure.

So... what problem are you really trying to solve here? What made you pick EDT as the weapon of choice? Might we suggest an alternative?
Where does the data come from, where is it going? Approxiamate volume (thousands, millions or billions or records?)
Any performance requirements ?
Any resource restrictions (memory, disk)?

note: More and more precise info will often lead to better answers. But tell us too much and it will look like work and we'll skip it or send you qoute :-).


Hope this helps some,
Hein van den Heuvel (at gmail dot com)
HvdH Performance Consulting








Hoff
Honored Contributor

Re: EDT and string size in the substitute command

perl and gawk and other text-oriented tools are typically massively superior to any sort of heavy text processing using EDT or similar vintage editor. (Even SUM/SLP or brute-force DCL can be preferable.)

And there are better editors around that maintain compatibility with your EDT finger memories; with the keypad commands. EVE has an EDT keypad mode, as does LSE.

EDT is, um, the software equivalent of a zombie.
George Tjionas
Occasional Contributor

Re: EDT and string size in the substitute command

Hein,

"automated procedure"

Many years ago I wrote a global editing procedure that invokes EDT to do global substitutions (of all s in a file or in many wild*card files).

It is nothing fancy but it is EDT/DCL based. and I call it for all different reasons, passing into the old and the new strings through DCL P-parameters. I many situation it help me a lot to do massive edits in a second.

It worked OK for short strings but it just didn't do the job for a large value in the substitute command.

I though it would be just a "SET to increase the length but I get the feeling that's not a possible workaround. Maybe it's time for another DCL adventure or someone else's work already available.

George
John Gillings
Honored Contributor

Re: EDT and string size in the substitute command

George,

>Maybe it's time for another DCL adventure

Yes, you'd be better off doing this with TPU. Here's a start:

GLOBSUBS.COM
$ IF p1.EQS."" THEN INQUIRE p1 "Filespec"
$ IF p1.EQS."" THEN EXIT
$ IF p2.EQS."" THEN INQUIRE p2 "Search string"
$ IF p2.EQS."" THEN EXIT
$ IF p3.EQS."" THEN INQUIRE p3 "Substitute string"
$ lf=""
$ wo="WRITE SYS$OUTPUT"
$ loop: f=F$SEARCH(p1)
$ IF f.NES."".AND.f.NES.lf
$ THEN
$ PIPE wo "eve_global_replace(""''p2'"",""''p3'"");exit;" | -
EDIT/TPU/NODISPLAY/COMMAND=SYS$PIPE 'f' > NL:
$ lf=f
$ GOTO loop
$ ENDIF

(cursory testing only, included as text attachment as well).
Remove the "> NL:" to see the informational output from TPU.

Obviously the lengths of the strings will be limited by DCL symbol and line lengths.
A crucible of informative mistakes