Или вот еще пример:
A4 s Q=4 i $o(@%sys("TNS","WM")@(%sys,%W,0,"I",""))="" d M3 g ST
k z d Q1 g:$g(z)=2 ST s i=""
f s i=$o(@%sys("TNS","WM")@(%sys,%W,0,i)) q:i="" i (i'="B")&(i'="I")&(i'="S")&(i'="T") k ^(i)
d Q2 g:z=1 F4 d BG^%WEZS
d F0 s I="B",i="*",c="Blank (Begin,End,PgUp,PgDn)",s="" d F1 f z="B","E","U","D" d F2
s n=0,r=$c(0),I="I",S="" f i=1:1 q:$d(@%sys("TNS","WM")@(%sys,%W,0,"S",i))=0 s S=S_^(i)
f s n=n+1,i=$p(S,r,n) q:i="" s z=@%sys("TNS","WM")@(%sys,%W,0,I,i),y=$p(z,r)+$a(f,7)-1,x=$p(z,r,2),l=$p(z,r,3),c=$p(z,r,6),s=$$DSP^%pb($e(@%sys("TNS","WM")@(%sys,%W,$a(f,y+11)),x,x+l-1),7) d F1 s z="B" d F2 d f z="E","M" d F2
.s z=$g(@%sys("TNS","WM")@(%sys,%W,0,I,i,"R")),@%sys("TNS","WM")@(%sys,%W,0,"T",a)=".R"_$s(z]"":" "_$p(z,":",1,6)_":"_$p(z,":",10,255),1:" 1:"_l_":<:95:32::"),a=a+1
.s z="R" f k=1:1 q:$d(@%sys("TNS","WM")@(%sys,%W,0,I,i,z,k))=0 s @%sys("TNS","WM")@(%sys,%W,0,"T",a)=" "_^(k),a=a+1
k r,S s n=n-1 g F3
;
A5 q