Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FHZDOC2

FHZDOC2.m

Go to the documentation of this file.
FHZDOC2 ; HISC/REL - Diagram Menus ;3/12/89  20:56 
 ;;5.5;DIETETICS;;Jan 28, 2005
 W !! D INIT
 R "Select USER or OPTION name: ",X:DTIME S DIC=3,DIC(0)="EMZ",DIC("S")="I $D(^(201)),^(201)",FL="US" G:X=""!(X["^") END
RQUE D ^DIC I Y>0 S D0=+Y,MQ=$P(Y(0),U,1),Y=+^(201) I $D(^DIC(19,Y,0)) D E G:'FL QPU D GO Q
 S DIC=19,DIC(0)="QEMZ" K DIC("S") D ^DIC S FL="OP",D0=+Y I Y=-1 G FHZDOC2
 I $P(Y(0),U,4)'="M" W !,*7,"This is not a menu option and therefore cannot be diagrammed.",! G FHZDOC2
 D:Y>0 E G:'FL QPU Q
 ;
OP ;
 D INIT S Y=D0 D E:$D(^DIC(19,Y,0)) G GO
US ;
 D INIT Q:'$D(^VA(200,D0,201))  S XQDUZ=D0,Y=+^(201) Q:'$D(^DIC(19,Y,0))  D E
GO K X,XQV,DIC U IO S W=IOM\M-10,%="" S:W>33 W=33
 I W<10 D ^%ZISC W !,*7,"This menu contains too many levels to be diagrammed using this margin width." G FHZDOC2
 S X=^TMP($J,"XQM",1,0),Z=$P(X,"^",2)
 W @IOF,!!?(IOM-17-$L(Z)\2),"DIAGRAM OF MENU: ",Z
 K ^TMP($J,"XQM",1,0) W !,$P(X,U,3)," (",$P(X,U,2),")",!,"|",!,"|"
 F XQL=1:1 Q:'$D(^TMP($J,"XQM",XQL))  S XQT=M,L=1 K Z D L
 D END
Q Q
 ;
L G LL:'$D(^TMP($J,"XQM",XQL,L)) S Y=1,XQV=^(L) I $D(^(L,1)) S XQV(L)=^(1)
 E  S:$P(XQV,U,5)'="M" XQT=L
 S XQP=$P(XQV,U,1),XQP(L)=$E("-----",1,5-$L(XQP))_XQP,X=$P(X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