Index: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIE0.m
===================================================================
--- WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIE0.m	(revision 613)
+++ WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIE0.m	(revision 623)
@@ -1,71 +1,74 @@
-DIE0	;SFISC/GFT-BRANCHING, UP-ARROWING ;27MAR2006
-	;;22.0;VA FileMan;**60,159**;Mar 30, 1999;Build 8
-	;Per VHA Directive 2004-038, this routine should not be modified.
-	G Q^DIE1:$D(DTOUT) G:X'?1"^".E T^DIED:$P($P(DQ(DQ),U,4),";E",2),X
-	I $D(DIE("NO^")),X=U,DIE("NO^")'["OUTOK" W !?3,"EXIT NOT ALLOWED " G X
-	I $D(DIE("NO^")),X?1"^"1E.E,DIE("NO^")'["BACK" W !?3,"JUMPING NOT ALLOWED " G X
-	I $L(X,"^")-1>1 S X=$E(X,2,99) G DIE0
-	S X=$P(X,U,2),DIC(0)="E"
-OUT	I X=""!(DP<0) S DIK=X,DC=$S($D(DQ(DQ))#2:$P(DQ(DQ),U,4),1:DQ) G OUT^DIE1
-	I DR]"" G A:X?1"@".N S DIC("S")="D S^DIE0" S:'$D(DR(DIE1,DP)) DR(DIE1,DP)=DR
-	S DDBK=0,DIC="^DD("_DP_"," D ^DIC I Y>0 D S
-	E  W:DDBK !?3,"JUMPING FORWARD NOT ALLOWED "
-	K DTOUT,DIC,DDBK,DDFND,DDONE,A0,A1,A2
-	I Y<0 S DG=DK,DH=":"_DM G X
-	S DI=$S(DH[":":+Y,1:DH),DK=DG D ^DIE1:$D(DG)>9 K DG,DB,DE,DQ,DIFLD S DQ=0 G JMP^DIE
-X	W:X'["?"&'$D(ZTQUEUED) $C(7),"??" G B^DIED:'$D(DB(DQ)),B^DIE1
-	;
-BR	;From ^DIED
-	S Y=U,X=$G(X) X DQ(0,DQ) D:$D(DIEFIRE)#2 FIREREC^DIE1 G A^DIED:$D(Y)[0,A^DIED:Y=U S D=$S(+Y=Y:9999,1:DQ),X="" I 0[Y S DQ=0 G OUT
-D	S D=D+1 I '$D(DQ(D)) G D:$D(DQ(0,D)) S DQ=9999,X=Y,DIC(0)="FO" G OUT
-	G D:$P(DQ(D),Y,1)]"" S DQ=D G RE^DIED
-	;
-O	;From ^DIE
-	K DQ S (DI,DV,DM)=0 I X]"",$D(@(U_$P(DC,U,3)_X_",0)"))#2 D S^DIE1,DIEC
-	S DQ=0 G MORE^DIE
-	;
-DIEC	S DIE=U_$P(DC,U,3),DIEC(DL)=DA F %=1:1 Q:'$D(DA(%))  S DIEC(DL,%)=DA(%)
-	K DA,DB,DE,DG F %=0:1:DIEL-1 S DA="D"_%,DIEC(DL,0,%)=@DA K @DA
-	S:$D(DIETMP)#2 DIEC(DL,"IENS")=DIIENS,DIIENS=X_","
-	S DIEL=0,(D0,DA)=X Q
-	;
-DIEZ	;
-	I X="" G @("A"_U_DNM)
-	S D=0,DL=DL+1,DNM(DL)=DNM,DNM(DL,0)=DQ,DIEL=DIEL+1 D DIEC G @DGO
-	;
-A	I $D(DR(DIE1,DP))>9 D OA ;Branching to "@N"
-	E  F DG=1:1 S DH=$P(DR(DIE1,DP),";",DG) G X:DH="" I DH=X S:$D(DOV) DOV=0 S DR=DR(DIE1,DP) Q
-	S DK=DG,DI=X D ^DIE1 G JMP^DIE
-OA	S %=0 F  S %=$O(DR(DIE1,DP,%)) Q:%=""  F DG=1:1 S DH=$P(DR(DIE1,DP,%),";",DG) Q:DH=""  I DH=X S DR=DR(DIE1,DP,%),DOV=%,%=9999 Q
-	S %=-1 Q
-	;
-E	;UNEDITABLE & DINUM fields
-	I X="@" Q:DV'["I"  G NO
-	Q:X[U!(X?."?")!DV!$D(DITC)
-NO	W:'$D(DB(DQ)) $C(7),"   NO EDITING!!" K X
-Q	Q
-	;
-	;
-	;
-S	;SCREEN fields;  out= $T
-	N DDR S (%,DDFND)=0,DDR=DR(DIE1,DP),DDBK=0,Y=+Y
-	I $D(DIE("NO^")),DIE("NO^")["BACK" S DDBK=1
-	D S1 I DDFND Q
-	I 'DDONE,$D(DR(DL,DP))>9 F %=-1:0 S %=$O(DR(DIE1,DP,%)) Q:%=""  S DDR=DR(DIE1,DP,%) D S1 Q:DDONE!DDFND
-	Q
-S1	;selectable?
-	S DDONE=0 F DG=1:1 D S2 Q:DDFND!DDONE!(DH="")
-	I DDFND S DOV=%,DR=$G(DR(DIE1,DP,%),$G(DR(DIE1,DP)))
-	Q
-S2	;parse for ;-piece
-	S DH=$P(DDR,";",DG) Q:(DH["///"&(DIC(0)'["F"))!'DH
-	;list
-	I 'DDBK,+DH=Y S DDFND=1 Q
-	I DDBK,+DH=DIFLD,+DH'=Y S DDONE=1 Q
-	I DDBK,+DH=Y S DDFND=1 Q
-	Q:$P(DH,"//")'[":"
-	;range
-	S A0=+$P(DH,":",1),A1=+$P(DH,":",2)
-	I 'DDBK,Y'<A0,Y'>A1 S DDFND=1 Q
-	F A2=A0-.000001:0 S A2=$O(^DD(DP,A2)) Q:A2>A1!'A2  S:A2=DIFLD&(A2'=Y)&DDBK DDONE=1 Q:DDONE  I A2=Y,(A2'>DIFLD) S DDFND=1 Q
-	Q
+DIE0 ;SFISC/GFT-BRANCHING, UP-ARROWING ;5:49 AM  21 Sep 2000
+ ;;22.0;VA FileMan;**60**;Mar 30, 1999
+ ;Per VHA Directive 10-93-142, this routine should not be modified.
+ G Q^DIE1:$D(DTOUT) G:X'?1"^".E T^DIED:$P($P(DQ(DQ),U,4),";E",2),X
+ I $D(DIE("NO^")),X=U,DIE("NO^")'["OUTOK" W !?3,"EXIT NOT ALLOWED " G X
+ I $D(DIE("NO^")),X?1"^"1E.E,DIE("NO^")'["BACK" W !?3,"JUMPING NOT ALLOWED " G X
+ I $L(X,"^")-1>1 S X=$E(X,2,99) G DIE0
+ S X=$P(X,U,2),DIC(0)="E"
+OUT I X=""!(DP<0) S DIK=X,DC=$S($D(DQ(DQ))#2:$P(DQ(DQ),U,4),1:DQ) G OUT^DIE1
+ I DR]"" G A:X?1"@".N S DIC("S")="D S^DIE0" S:'$D(DR(DL,DP)) DR(DL,DP)=DR
+ S DDBK=0,DIC="^DD("_DP_"," D ^DIC I Y>0 D S
+ E  W:DDBK !?3,"JUMPING FORWARD NOT ALLOWED "
+ K DTOUT,DIC,DDR,DDBK,DDFND,DDONE,A0,A1,A2
+ I Y<0 S DG=DK,DH=":"_DM G X
+ S DI=$S(DH[":":+Y,1:DH),DK=DG D ^DIE1:$D(DG)>9 K DG,DB,DE,DQ,DIFLD S DQ=0 G JMP^DIE
+X W:X'["?"&'$D(ZTQUEUED) $C(7),"??" G B^DIED:'$D(DB(DQ)),B^DIE1
+ ;
+BR ;
+ S Y=U X DQ(0,DQ) D:$D(DIEFIRE)#2 FIREREC^DIE1 G A^DIED:$D(Y)[0,A^DIED:Y=U S D=$S(+Y=Y:9999,1:DQ),X="" I 0[Y S DQ=0 G OUT
+D S D=D+1 I '$D(DQ(D)) G D:$D(DQ(0,D)) S DQ=9999,X=Y,DIC(0)="FO" G OUT
+ G D:$P(DQ(D),Y,1)]"" S DQ=D G RE^DIED
+ ;
+O ;
+ K DQ S (DI,DV,DM)=0 D DUZ I X]"",$D(@(U_$P(DC,U,3)_X_",0)"))#2 D S^DIE1,DIEC
+ S DQ=0 G MORE^DIE
+ ;
+DIEC S DIE=U_$P(DC,U,3),DIEC(DL)=DA F %=1:1 Q:'$D(DA(%))  S DIEC(DL,%)=DA(%)
+ K DA,DB,DE,DG F %=0:1:DIEL-1 S DA="D"_%,DIEC(DL,0,%)=@DA K @DA
+ S:$D(DIETMP)#2 DIEC(DL,"IENS")=DIIENS,DIIENS=X_","
+ S DIEL=0,(D0,DA)=X Q
+ ;
+DUZ Q:X=""!(DUZ(0)="@")
+ ;S DIFILE=$P(DC,U,2),DIAC="WR" D ^DIAC K DIAC,DIFILE G:'% 3
+ Q
+3 ;W $C(7),!?7,"(YOU DO NOT HAVE 'WRITE ACCESS' TO THE '"_$P(^DIC($P(DC,U,2),0),U)_"' FILE)" S X=""
+ Q
+ ;
+DIEZ ;
+ D DUZ I X="" G @("A"_U_DNM)
+ S D=0,DL=DL+1,DNM(DL)=DNM,DNM(DL,0)=DQ,DIEL=DIEL+1 D DIEC G @DGO
+ ;
+A I $D(DR(DL,DP))>9 D OA
+ E  F DG=1:1 S DH=$P(DR(DL,DP),";",DG) G X:DH="" I DH=X S:$D(DOV) DOV=0 S DR=DR(DL,DP) Q
+ S DK=DG,DI=X D ^DIE1 G JMP^DIE
+OA S %=0 F  S %=$O(DR(DL,DP,%)) Q:%=""  F DG=1:1 S DH=$P(DR(DL,DP,%),";",DG) Q:DH=""  I DH=X S DR=DR(DL,DP,%),DOV=%,%=9999 Q
+ S %=-1 Q
+ ;
+E ;
+ I X="@" Q:DV'["I"  G NO
+ Q:X[U!(X?."?")!DV!$D(DITC)
+NO W:'$D(DB(DQ)) $C(7),"   NO EDITING!!" K X
+Q Q
+S ;reg or ovfl, out= $T
+ S (%,DDFND)=0,DDR=DR(DL,DP),DDBK=0,Y=+Y
+ I $D(DIE("NO^")),DIE("NO^")["BACK" S DDBK=1
+ D S1 I DDFND Q
+ I 'DDONE,$D(DR(DL,DP))>9 F %=-1:0 S %=$O(DR(DL,DP,%)) Q:%=""  S DDR=DR(DL,DP,%) D S1 Q:DDONE!DDFND
+ Q
+S1 ;selectable?
+ S DDONE=0 F DG=1:1 D S2 Q:DDFND!DDONE!(DH="")
+ I DDFND S DOV=%,DR=$S($D(DR(DL,DP,%)):DR(DL,DP,%),$D(DR(DL,DP)):DR(DL,DP),1:"")
+ Q
+S2 ;parse for ;-piece
+ S DH=$P(DDR,";",DG) Q:(DH["///"&(DIC(0)'["F"))!'DH
+ ;list
+ I 'DDBK,+DH=Y S DDFND=1 Q
+ I DDBK,+DH=DIFLD,+DH'=Y S DDONE=1 Q
+ I DDBK,+DH=Y S DDFND=1 Q
+ Q:$P(DH,"//")'[":"
+ ;range
+ S A0=+$P(DH,":",1),A1=+$P(DH,":",2)
+ I 'DDBK,Y'<A0,Y'>A1 S DDFND=1 Q
+ F A2=A0-.000001:0 S A2=$O(^DD(DP,A2)) Q:A2>A1!'A2  S:A2=DIFLD&(A2'=Y)&DDBK DDONE=1 Q:DDONE  I A2=Y,(A2'>DIFLD) S DDFND=1 Q
+ Q
