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((XQFMT>0):" ["_$P(XQI,U,1)_"]",1:"") W !?(80-$L(XQI)\2),XQI,!?(80-$L(XQI)\2),$E(XQDSH,1,$L(XQI)),!
 S XQX=.002,XQPG(0)="a" F XQI=1:1 S XQX=$O(^DIC(9.2,XQHY,1,XQX)) Q:XQX=""  D:($Y+4)>IOSL NWPG Q:XQUI  W !,^(XQX,0)
 W ! Q
KEYW ;
 Q:'$D(^DIC(9.2,XQHY,2))  Q:'$P(^(2,0),U,3)  S XQS=0
 I $E(IOST,1)="C" S XQPG(0)="b" D NWPG Q:XQUI
 W !!,$E(XQDSH,1,79),!
 K XQKW S XQK=0 F XQJ=1:1 S XQK=$O(^DIC(9.2,XQHY,1,XQK)) Q:XQK=""  S XQJ=^(XQK,0) F XQL=1:1 S XQKW=$P($P(XQJ,"]",XQL),"[",2) Q:'$L(XQKW)  S XQKW(XQKW)=""
 W !!,"KEYWORD",?34,"RELATED FRAME" W ?75,"PAGE",!,$E(XQDSH,1,7),?34,$E(XQDSH,1,13) W ?75,$E(XQDSH,1,4) W !
 S XQJ=0 F XQK=1:1 S XQJ=$O(^DIC(9.2,XQHY,2,XQJ)) Q:XQJ'=+XQJ  S XQL=^(XQJ,0) D KEYW1
 S XQJ=0 F XQK=1:1 S XQJ=$O(XQKW(XQJ)) Q:XQJ'>0  W !,XQJ," **" S XQS=1
 I XQS W !!?3,"*  - KEYWORD MISSING FROM TEXT",!?3,"** - RELATED FRAME MISSING FROM LIST"
 Q
KEYW1 S XQKW=$P(XQL,U,1),XQL=$P(XQL,U,2) W !,XQKW
 W:'$D(XQKW(XQKW)) " *" S:'$D(XQKW(XQKW)) XQS=1 K XQKW(XQKW) I $L(XQL),$D(^DIC(9.2,XQL)) S XQK=^(XQL,0) W ?34,$P(XQK,U,2) W:XQFMT !?34,"[",$P(XQK,U,1),"]" W ?76,+^TMP($J,"XQM",XQL)
 Q
NWPG ;
 S:XQPG<1 XQPG=XQPG-1 I $E(IOST,1)="C" D CON S XQUI=(X="^") Q:XQUI
 D HDR Q
CON ;
 W !,"Press return to continue or '^' to escape " R X:DTIME S:'$T X=U
 Q
HDR ;
 W @IOF
 S Y=$P($H,",",2)\60,Y=(Y#60/100+(Y\60)/100+DT) D DT^DIO2
 W ?30,"HELP FRAME LISTING",?71 W $S(XQPG>0:"PAGE "_XQPG_XQPG(0),1:"    "_$E(XQRN,-XQPG*4+1,-XQPG*4+4)) W !!?(80-$L(XQHDR)\2),XQHDR,!
 I XQPG<1 W !?30,"TABLE OF CONTENTS",!?30,$E(XQDSH,1,17),!?75,"PAGE",!
 Q
