[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: Long strings in CI ///



Reply to note from Carl Distefano  Tue, 30 Nov 2010
19:52:50 -0500

Harry and all:

> There's a U2 routine called BIGCHG, which may help. It's been a
> while since I've used it, but as I recall it works pretty well.

I've revisited BIGCHG. It does work well, but there's a glitch if
the strings to be replaced occur seriatim with nothing in between.
Glitch solved; please use new code below.

I should add that the usage for this routine is not self-evident;
you really need to read the Help screen (HELP BIGCHG).
Basically, the way it works is that you first save the replacement
string (the new material) to Save/Get K. (If you don't like S/G K,
you can designate a different S/G in XYWWWEB.REG.) Then, in your
document, you DeFine an instance of the existing string (the
material to be replaced), move the cursor to the desired starting
position (ahead of the DeFine if you want to replace the DeFined
string), and issue BIGCHG to execute. There are 3 optional
args: A for case-Absolute search/replace; T for search/replace from
Top of file; V for Verify before replacing (as in the CV command).
These args can be combined, as in BIGCHG ATV. If the search
string contains wildcards or a carriage return, the Verify option is
deployed automatically. There are limitations on the use of
wildcards; for details, read the Help screen.

There are memory limitations with BIGCHG, but I've successfully used
it to replace one 1.5KB string with another -- that's the equivalent
of a 3000-character CHange command, as opposed to the 79 or so that
can fit on the CMline and the 150 or so that you can stuff into a
BX...Q2 statement.

Enjoy!

XPLeNCODE v2.0
b-gin [UNTITLED]
{{;5bigchg}} Search & replace on long strings (v2; CLD 7/26/9
8; rev.11/30/10) (UserVar)[cr|lf]{002};*; Save/Get to use for
 replacement string[cr|lf]{<}SV99,Replacement_AlphaNumeric_S/
G{>}[JM_]2.RegData[Q2_]{<}SX01,{<}IS99{>}{>};*;[cr|lf][XH_][B
X_]es 1[Q2_][DX_]{<}SX02,@upr({<}IS50{>}){>}[DZ_]{<}IF{<}IS02
{>}{240}"R"{>}{<}IF{<}VA$DE{>}<1{>}{<}PRNo replacement text D
eFined{>}{<}EX1{>}{<}EI{>}{<}SX03,"{<}SV"+{<}IS01{>}+"{>}"{>}
{<}PV03{>}{<}SX03,"{<}PRReplacement text saved to S/G "+@upr(
{<}IS01{>})+"{>}"{>}{<}PV03{>}{<}EX{>}{<}EI{>}{<}SV03,[wX]{>}
{<}SV04,{192}{>}{<}XS03,04,04,05,06{>}{<}SX04,{<}IS04{>}+{<}I
S05{>}{>}{<}IF{<}VA$DE{>}<1!@abs(0+{<}VA$DN{>}-{<}VA$DS{>})<1
{>}[DO_]{<}PRNo search string DeFined{>}{<}EX1{>}{<}EI{>}{<}S
V03{>}[YD_]{<}SV05,[cr|lf]{>}{<}LBa{>}{<}IF{<}IS03{>}{240}{<}
IS05{>}{>}{<}SV06,{>}{<}XS03,05,07,,06{>}{<}SX03,{<}IS07{>}+"
[wC]"+{<}IS06{>}{>}{<}GLa{>}{<}EI{>}{<}SX05,"{<}SX06,{<}VA|"+
{<}IS01{>}+"{>}{>}"{>}{<}PV05{>}{<}IF{<}PV06{>}<0{>}{<}SX01,"
{<}PRNo replacement text in S/G "+@upr({<}IS01{>}+"{>}"{>}{<}
PV01{>}{<}EX1{>}{<}EI{>}{<}SX05,"{<}SX06,{<}IS"+{<}IS01{>}+"{
{062}}{>}"{>}{<}PV05{>};*;[cr|lf]{<}SV01,{027}X{027}X{027}X{027}X
{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{
027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{0
27}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{02
7}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027
}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}
X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X{027}X
{027}X{027}X{027}X{027}X{027}X{027}X{>}{<}SX05,{<}CP{>}{>}{<}
SV07,[BX_]jmp {<}PV05{>}[Q2_][YD_]{>}{<}IF{<}VA$DT{>}>0{>}[XP
_]{<}SX07,{<}IS07{>}+"[TG_]"{>}{<}EI{>}{<}IF{<}VA$FB{>}>0!{<}
IS02{>}{240}"T"{>}[TF_]
{<}SX05,0{>}{<}EI{>}{<}SX08,{<}IS01{>}+"[255+252+142]"{>}{<}I
F{<}VA|03{>}<={<}VA|01{>}/2{>}{<}SX09,{<}IS03{>}{>}{<}SX10,{<
}IS03{>}{>}{<}GLb{>}{<}EI{>}{<}XS03,01,,09,10{>}{<}SX11,{<}IS
03{>}+"[255+252+142]"{>}{<}XS11,08,,10,12{>}{<}SV08,[255+252+
142]{>}{<}XS10,08,11,,12{>}{<}SX10,{<}IS11{>}{>}{<}LBb{>}[XD_
][XD_][XD_][YD_]{<}IF{<}IS09{>}{240}{<}IS04{>}!{<}IS10{>}{240
}{<}IS04{>}{>}{<}SX02,{<}IS02{>}+"V"{>}{<}EI{>}{<}SX01,-1{>}{
<}SV08,{>}{<}SX11,-1{>}{<}SV12,{>}{<}IF{<}IS02{>}{240}"V"{>}{
<}SV12,| Y=yes, N=no, S=stop here, O=one more{>}{<}EI{>};*;[c
r|lf]{<}LBc{>}{<}IF"V"{238}{<}IS02{>}<0{>}{<}IF{<}PV01{>}>25{
{062}}{<}PRWorking...{>}{<}EI{>}{<}EI{>}[BX_]se{<}IF{<}IS02{>}{24
0}"A"{>}a{<}EI{>} [999]{<}PV09{>}[999][Q2_]{<}IF{<}PV05{>}<1{
{062}}{<}IF{<}PV11{>}<1{>}{<}SX05,0{>}{<}EI{>}{<}EI{>}{<}SX11,8{>
}{<}IF{<}ER{>}&{<}PV01{>}<0{>}[YD_]{<}LBd{>}{<}SV01,Not found
{>}{<}GLf{>}{<}EI{>}{<}IF{<}ER{>}{>}{<}LBe{>}{<}IF{<}PV01{>}<
0{>}{<}GLd{>}[cr|lf]{<}EI{>}{<}SX01,{<}IS01{>}+" change(s)"{>
}{<}LBf{>}{<}PV07{>}{<}PR@01{>}{<}EX{>}{<}EI{>}[BX_]seb{<}IF{
<}IS02{>}{240}"A"{>}a{<}EI{>} [999]{<}PV09{>}[999][Q2_][YD_][
DF_]{<}LBg{>}[BX_]se{<}IF{<}IS02{>}{240}"A"{>}a{<}EI{>} [999]
{<}PV10{>}[999][Q2_]{<}IF{<}ER{>}{>}{<}GLe{>}{<}EI{>}[DZ_]{<}
IF{<}PV01{>}<0{>}{<}SX01,{<}PV01{>}+1{>}{<}EI{>}{<}IF{<}IS09{
{062}}{240}{<}IS04{>}!{<}IS10{>}{240}{<}IS04{>}{>}{<}GLh{>}{<}EI{
{062}}{<}IF@abs(0+{<}VA$DN{>}-{<}VA$DS{>})>{<}VA|03{>}{>}{<}GLc{>
}{<}EI{>}{<}IF@abs(0+{<}VA$DN{>}-{<}VA$DS{>})<{<}VA|03{>}{>}[
DM_]{<}GLg{>}{<}EI{>}{<}SV08{>}{<}IF"A"{238}{<}IS02{>}<0{>}{<
}SX08,@upr({<}IS08{>}){>}{<}EI{>}{<}IF{<}IS08{>}=={<}
IS03{>}{>}{<}IF"V"{238}{<}IS02{>}<0{>}{<}GLj{>}{<}EI{>};*;[cr
|lf]{<}LBh{>}[DO_]{<}SX11,0{>}{<}LBi{>}{<}PR@12{>}{<}SX11,@up
r({<}RK{>}){238}"{027}[ES_]SNOY"{>}{<}IF{<}PV11{>}<0{>}{<}GLi
{>}{<}EI{>}{<}IF{<}PV11{>}<5{>}{<}SV01,Change/Verify command{032}
canceled{>}{<}IF{<}PV11{>}>3{>}{<}SX05,{<}CP{>}{>}{<}EI{>}{<}
GLf{>}{<}EI{>}{<}IF{<}PV11{>}<6{>}[YD_]{<}GLc{>}{<}EI{>}{<}LB
j{>}[DN_]{<}GT06{>}{<}SX01,{<}PV01{>}+1{>}{<}IF{<}PV11{>}<7{>
}{<}SX05,{<}CP{>}{>}{<}GLe{>}{<}EI{>}{<}EI{>}[YD_]{<}GLc{>}{0
02}[cr|lf][cr|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx