DDMAP1 ;SFISC/JKS(Helsinki)-GRAPH OF FILEMAN PTRS ;22MAY2007
 ;;22.0;VA FileMan;**GFT,1028**;Mar 30, 1999
 ;
NXF S DDFLE=$O(^UTILITY($J,"FD",DDFLE)) G EXIT2^DDMAP:DDFLE'>0 S DDLN=1,DDOUT=0,DD9=0 I $Y>DDMIOSL D HDR^DDMAP2 G KILL^DDMAP:$D(DTOUT)
 D VIIVA^DDMAP2,TO S DDPCK=$$FILENAME^DIALOGZ(DDFLE) D FSHORT
 W ?DDTB1,"|  ",DDFLE," ",DDPCK W ?DDTB2,"|",! S DDFL="" ;write File name and number in box
 I $Y>DDMIOSL D HDR^DDMAP2 G KILL^DDMAP:$D(DTOUT)
NXFL S DDFL=$O(^UTILITY($J,"FD",DDFLE,"FR",DDFL)),DDFLD=0 I DDFL="" G END
NXFLD S DDFLD=$O(^UTILITY($J,"FD",DDFLE,"FR",DDFL,DDFLD)),DDFPT=0,DD5=DDFL G:DDFLD'>0 NXFL S DDFRN=$$LABEL^DIALOGZ(DDFL,DDFLD)
NXUP I $D(^DD(DD5,0,"UP")) S DD5=^("UP"),DD7=$$FILENAME^DIALOGZ(DD5) S:(DD5'=$P(DDFRN,":",1)) DDFRN=DD7_":"_DDFRN G NXUP
NXPT S DDFPT=$O(^UTILITY($J,"FD",DDFLE,"FR",DDFL,DDFLD,DDFPT)) G NXFLD:DDFPT'>0 S DDA2=^(DDFPT) D TO
REV S DDA1=$S($P(DDA2,U,2)["M":"m",1:""),DDA2=$S($P(DDA2,U,2)["V":"v",1:""),DDMAX=DDFNMAX,DDP=DDFRN D SHORT W ?DDTB1,"| " W:DDP]"" DDA2,DDA1,?DDTB1+4,DDP W ?DDTB2,"|" D OUT S DDFRN="" I $Y>DDMIOSL D HDR^DDMAP2 G KILL^DDMAP:$D(DTOUT)
 G NXPT
FSHORT I DDFNMAX-$L(DDFLE)-$L(DDPCK)<0 S DDPCK=$E(DDPCK,1,DDFNMAX-$L(DDFLE)-1)_"*"
 Q
SHORT Q:$L(DDP)'>DDMAX  S DDPP=$L(DDP,":"),DD5=DDP I DDPP>1 S DD7=DDMAX-DDPP\DDPP,DD5=$E($P(DDP,":",1),1,DD7) F I=2:1:DDPP S DD5=DD5_":"_$E($P(DDP,":",I),1,DD7)
 S DDP=$E(DD5,1,DDMAX-1)_"*" Q
OUT ;
 W "->",$P(DDFPT," ",2) W " " S DDP=$$FILENAME^DIALOGZ(DDFPT) S:DDP="" DDP="*** NONEXISTENT FILE "_DDFPT_"***" S DDMAX=IOM-$X D SHORT W DDP,!
 Q
 ;
 ;
TO N DDLGO ;WRITE LEFT SIDE OF BOX
 S DDP="",(DDCR,DDINC)=0 Q:'$D(^UTILITY($J,"FD",DDFLE,"TO",DDLN))
 S DDPT=$O(^(DDLN,"")),DDPTF=$O(^(DDPT,"")),DDA1=$$LABEL^DIALOGZ(DDPT,DDPTF)_U_$P(^DD(DDPT,DDPTF,0),U,2),DDLN=DDLN+1 I DDPT'>0 S DDP="*** NONEXISTENT FILE ***",DDTO="" G TOOK
 I '$D(^DD(DDPT)) S DDP="*** NONEXISTENT FILE "_DDPT_"***" G TOOK
 S DDPTF=+DDPTF,DDTO=DDPT,DDPP=$P(DDA1,U,1)
TOUP S DD5=$$FILENAME^DIALOGZ(DDTO) I $D(^DD(DDTO,0,"UP")) S DDTO=^("UP") S:(DD5'=$P(DDPP,":",1)) DDPP=DD5_":"_DDPP G TOUP
 S DDINC=$D(^UTILITY($J,"F",DDTO)),DDLGO=$P(DDA1,U,2)'["'",DDA1=$P(DDA1,U,2)["V" S:(DD5'=$P(DDPP,":",1)) DDPP=DD5_":"_DDPP
 S DDCR=0,DD5="",DD7=DDPT,DDP=DDPP S:DD7?.E1"."2N DD7=+$P(DD7,".",1,$L(DD7,".")-1)
 F I=1:1 S DD5=$O(^DD(DD7,0,"IX",DD5)) Q:DD5=""  I $D(^DD(DD7,0,"IX",DD5,DDPT,DDPTF)) S DDCR=1
TOOK Q:DDP=""
 S DDMAX=DDTB1-15,DD5=$P(DDP,":",1),DD7=DDP D  D SHORT
 .I DD5=DD9 S DDP="  "_$P(DDP,":",2,999),DDPT="" Q
 .W "  ",$S(IOST["C":$E(DD5,1,20),1:DD5)," (#",DDTO,")",?DDTB1,"|",?DDTB2,"|",!
 .S DDP="  "_$P(DD7,":",2,999),DD9=DD5,DDPT="" Q
 S DDW=$S('DDINC:"N S",1:"N") D
 .W "  ",DDP," " W:DDA1 "v " D  W ?DDTB1-12,"(",DDW," " S:'$D(DDLGO) DDLGO=0 W:DDCR "C " W:DDLGO "L" W ")->"
 ..F I=$L(DDP):1:DDTB1-18 W "."
 Q
 ;
 ;
END I $D(^UTILITY($J,"FD",DDFLE,"TO",DDLN)) D TO W:$X'>DDTB1 ?DDTB1,"|" W ?DDTB2,"|",! S DDOUT=1 D:$Y>DDMIOSL HDR^DDMAP2 G KILL^DDMAP:$D(DTOUT),END
 I DDOUT S DDOUT=0 D VIIVA^DDMAP2 G NXF
 S DDPCK=+$O(^UTILITY($J,"FD",DDFLE)) I '$D(^DD(DDPCK,0,"UP")) D VIIVA^DDMAP2
 G NXF
 Q
