Question Richard Prouvot · Apr 17, 2025

how can i escape the "<",">" symbols in *.scr script

i have a line in my *.scr file like this:

send: s rlt=##class(%SYS.Namespace).ListAll(.rlt)<CR>
wait for:USER>
send: S A="" F  S A=$O(rlt(A)) q:A=""  I A["USER"!(A["CLIE")  F I=1:1:$L(L,",")  S G="^["""_A_"""]"_$P(L,",",I)  S B="" F  S B=$O(@G@(B)) Q:B=""  F J=1:1:$L(B)  S V=$A($E(B,J,J))  I (V<48!(V>57))&&(V<65!(V>90))&&(V<97!(V>122))  W A,?10,G,?30,B,!<CR>
wait for:USER>
 

it errors out with this <SYNTAX> error where the "<" or ">" are not accepted.

 I (V057))&&(VA90))&&(Va122))  W A,?10,G,?30,B,!

How do I escape these characters so that my script works??

Thanks

Product version: Caché 2013.1
$ZV: Cache for Windows (x86-64) 2013.1

Comments

Richard Prouvot · Apr 17, 2025

i found that if i parameterize my values, it works.

set V48= "V<48"
set V57= "V>57"
set V65= "V<65"
set V90= "V>90"
set V97= "V<97"
set V122= "V>122"

     C:\Cachesys\bin\cterm.exe /console=cn_iptcp:%%x[23] C:\Users\................\ERROR_IN_CODES.scr %%x %V48% %V57% %V65% %V90% %V97% %V122% 
 

I (<p2>!(<p3>))&&(<p4>!(<p5>))&&(<p6>!(<p7>)) 

0
Vitaliy Serdtsev · Apr 18, 2025

Script Command Arguments:

Note:

Any ASCII (extended) character except NUL (000) can be produced via <ddd> where ddd is the decimal value of the character.

USER>w $a("<")
60
USER>w $a(">")
62

So, something similar is needed:

echo: off
send: s V=4 I (V<60>48!(V<62>57))&&(V<60>65!(V<62>90))&&(V<60>97!(V<62>122))  W A,?10,G,?30,B,!<CR>
wait for:USER>
0
Richard Prouvot  Apr 21, 2025 to Vitaliy Serdtsev

thank you. a very elegant solution.

0