DIA ;SFISC/GFT-SELECT FIELDS TO EDIT ;4JUNE2008
;;22.0;VA FileMan;**159**;Mar 30, 1999;Build 8
;Per VHA Directive 2004-038, this routine should not be modified.
D DICS
1 D F W !?F*3,"EDIT WHICH "_X I $S(DB:DIAT="",1:1) R ": ALL// ",X:DTIME S:'$T X=U,DTOUT=1 G ALL^DIA1:X=""!(X="ALL"),TEMP^DIA1:X?1"[".E&'F,L
ED G NDB:DIAT=""
GDB S Y=$P(DIAT,";",DB) I "Q"[Y G NDB:Y="" D DB G GDB
I Y?.NP,$P(Y,":",2),Y'["/" S Y=+Y_"-"_$P(Y,":",2)
S %=$G(DI(DB,DIARTLVL-1,DI,DIAO)) I %]"" S Y=%
E I Y?1"^"1N1"."1.2N S DB=DB+1 G GDB ;WPB-0804-30857
W ": "_Y D RW
I X="" S X=Y I X="ALL" G ALL^DIA1
L S DSC=X?1"^".E I DSC S X=$E(X,2,999) I U[X K DR Q
I $A(X)=64 G X:X'?1P.N,P:$L(X)>1,X:'DB S DB=DB+1 G 2
K DIC,DIAB D DICS S DV="",J=$P(X,"-",2) I +J=J,$P(X,"-",1)=+X,J>X S D(F)=J K DA D RANGE^DIA1 K D S Y=DA G X:Y="" D DB G 2
DIC ;
S DIC(0)="EZI",DIC="^DD(DI,",Y=-1 G X^DIA3:X[";" S DIC("W")="S %=$P(^(0),U,2) I % W $S($P(^DD(+%,.01,0),U,2)[""W"":"" (word-processing)"",1:"" (multiple)"")" D ^DIC Q:$D(DTOUT)
I Y>0 D SET S Y=$P(Y(0),U,2) G 2:'Y S L=L+1,(DI,J(L))=+Y,I(L)=""""_$P($P(Y(0),U,4),";")_"""" G DOWN
I $E(X)="]" S DRS=9,X=$E(X,2,999) G DIC:X]"",2
G DIA^DIQQQ:X?."?" I $D(^DD(DI,"GR")) K Y S Y=-1 D:$L(X)<31
. N I,DIGRP,DTOUT,DUOUT,DIRUT,DIROUT,DIYN S DIGRP=X,DIYN=0
. D:$D(^DD(DI,"GR",DIGRP)) Q:DIYN F S DIGRP=$O(^DD(DI,"GR",DIGRP)) Q:$E(DIGRP,1,$L(X))'=X D Q:DIYN
.. N X,I
.. F I=0:0 S I=$O(^DD(DI,"GR",DIGRP,I)) Q:'I I $G(^DD(DI,I,0))]"" S I(I)=I_U_$P(^(0),U)
.. Q:'$O(I(0))
.. W !!,"Fields in Group: ",DIGRP F I=0:0 S I=$O(I(I)) Q:'I W !,?2,I,?10,$P(I(I),U,2)
.. D Q:DIYN'=1
... N X,Y S DIR(0)="Y",DIR("A")="Edit this GROUP of fields",DIR("B")="YES" D ^DIR S DIYN=$S(Y=1:1,$G(DIRUT):2,1:0) Q
.. M Y=I S Y=0 Q
. Q
K DIYN G X^DIA3
;
F S X=$P(^DD(DI,0),U) I F,X="FIELD" S X=$O(^(0,"NM",0))_" "_X
Q
;
X ;
W $C(7),"??" D DICS
2 ;
G 1:'$D(DR(F+1,DI)) D F W !?F*3,"THEN EDIT "_X G ED:DB
R R ": ",X:DTIME E W $C(7) S X=U,DTOUT=1
I X]"" G L
UP ;
G ^DIA1:'F K I(L),J(L) S L=L-1 I '$D(J(L)) F L=L-99:1 Q:'$D(J(L+1))
I DB S DB=DB(F),DIARTLVL=DIARTLVL(F),DIAO=DIAO(F),DIAT=$S(DIAO<0:"",DIAO:$G(^DIE(DIAA,"DR",DIARTLVL,J(L),DIAO)),$D(^DIE(DIAA,"DR",DIARTLVL,J(L))):^(J(L)),1:"")
S DIARLVL=DIARLVL(F),DIAP=DIAP(F),DI=J(L),F=F-1 G 2
;
NDB I DB,DIAO'<0 S DIAO=DIAO+1 I $D(^DIE(DIAA,"DR",DIARLVL,DI,DIAO)) S DIAT=^(DIAO),DB=1 G GDB
S DIAO=-1 G R
;
;
;
EN ;Entry point from DIB routine
N DIARTLVL,DIARLVL,DIAL,DIESP,DRR D OS^DII:'$D(DISYS)
FILETOP D DICS ;Enter from DIA3 when there is a file jump
DOWN S F=F+1,DIAL(F)=+$G(DIAL),DIARLVL(F)=+$G(DIARLVL) F %=F+1:.01 I '$D(DR(%,DI)) Q ;Find 2.01 if we have already gone down to DR(2,DI) -- WPB-0804-30857
S:%["." @DRR=@DRR_U_%_";",DIAP=DIAP+1 S DIARLVL=%
S DIAP(F)=DIAP,DIAP=0
I DB S DIARTLVL(F)=DIARTLVL D S DB(F)=DB,DB=1,DIAO(F)=DIAO,DIAO=0,DIAT=$G(^DIE(DIAA,"DR",DIARTLVL,DI)),DIARTLVL(DIARTLVL,DI)=""
.S %=$P(DIAT,";",DB) I %?1"^"1.NP S DIARTLVL=$P(%,U,2),DB=DB+1 Q
.F DIARTLVL=F+1:.01 I '$D(DIARTLVL(DIARTLVL,DI)) Q
G 1:$P(^DD(DI,.01,0),U,2)'["W",1:L#100=0,UP
;
DICS ;
S DIC("S")="I Y>.001,$P(^(0),U,2)'[""C"""_$S(DUZ(0)="@":"",1:",$P(^(0),U,2)'[""K""")_" Q:'$D(^(9)) I ^(9)'=U"_$S(DUZ(0)'="@":" F DW=1:1:$L(^(9)) I DUZ(0)[$E(^(9),DW) Q",1:"") Q
;
P ;
S DRS=99,Y=X D DB G 2
;
SET S Y=+Y_DV
DB ;
I DB,'DSC S DB=DB+1
D ;takes 'Y' and puts it into 'DR' array -- Also called from DIA3
N %,B
S (DRR,B)=$NA(DR(DIARLVL,DI)),%=$O(@DRR@(""),-1)
I % S DRR=$NA(@DRR@(%))
I '$D(@DRR) S @DRR="",DIAP=0
E I $L(Y)+$L(@DRR)>230 S DRR=$NA(@B@(%+1)),DIAP=DIAP\1000+1*1000,@DRR=""
S @DRR=@DRR_Y_";",DRS=$G(DRS)+1
S DIAP=DIAP+1
DIAB I $D(DIAB) S ^UTILITY($J,DIAP#1000,DIARLVL-1,DI,DIAP\1000)=DIAB K DIAB
Q
;
RW I $L(Y)>19 D RW^DIR2 Q
W "// " R X:DTIME I '$T S X=U,DTOUT=1 W $C(7)
DIA ;SFISC/GFT-SELECT FIELDS TO EDIT ;4JUNE2008
+1 ;;22.0;VA FileMan;**159**;Mar 30, 1999;Build 8
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 DO DICS
1 DO F
WRITE !?F*3,"EDIT WHICH "_X
IF $SELECT(DB:DIAT="",1:1)
READ ": ALL// ",X:DTIME
IF '$TEST
SET X=U
SET DTOUT=1
IF X=""!(X="ALL")
GOTO ALL^DIA1
IF X?1"[".E&'F
GOTO TEMP^DIA1
GOTO L
ED IF DIAT=""
GOTO NDB
GDB SET Y=$PIECE(DIAT,";",DB)
IF "Q"[Y
IF Y=""
GOTO NDB
DO DB
GOTO GDB
+1 IF Y?.NP
IF $PIECE(Y,":",2)
IF Y'["/"
SET Y=+Y_"-"_$PIECE(Y,":",2)
+2 SET %=$GET(DI(DB,DIARTLVL-1,DI,DIAO))
IF %]""
SET Y=%
+3 ;WPB-0804-30857
IF '$TEST
IF Y?1"^"1N1"."1.2N
SET DB=DB+1
GOTO GDB
+4 WRITE ": "_Y
DO RW
+5 IF X=""
SET X=Y
IF X="ALL"
GOTO ALL^DIA1
L SET DSC=X?1"^".E
IF DSC
SET X=$EXTRACT(X,2,999)
IF U[X
KILL DR
QUIT
+1 IF $ASCII(X)=64
IF X'?1P.N
GOTO X
IF $LENGTH(X)>1
GOTO P
IF 'DB
GOTO X
SET DB=DB+1
GOTO 2
+2 KILL DIC,DIAB
DO DICS
SET DV=""
SET J=$PIECE(X,"-",2)
IF +J=J
IF $PIECE(X,"-",1)=+X
IF J>X
SET D(F)=J
KILL DA
DO RANGE^DIA1
KILL D
SET Y=DA
IF Y=""
GOTO X
DO DB
GOTO 2
DIC ;
+1 SET DIC(0)="EZI"
SET DIC="^DD(DI,"
SET Y=-1
IF X[";"
GOTO X^DIA3
SET DIC("W")="S %=$P">P(^(0),U,2) I % W $S($P">P(^DD(+%,.01,0),U,2)[""W"":"" (word-processing)"",1:"" (multiple)"")"
DO ^DIC
IF $DATA(DTOUT)
QUIT
+2 IF Y>0
DO SET
SET Y=$PIECE(Y(0),U,2)
IF 'Y
GOTO 2
SET L=L+1
SET (DI,J(L))=+Y
SET I(L)=""""_$PIECE($PIECE(Y(0),U,4),";")_""""
GOTO DOWN
+3 IF $EXTRACT(X)="]"
SET DRS=9
SET X=$EXTRACT(X,2,999)
IF X]""
GOTO DIC
GOTO 2
+4 IF X?."?"
GOTO DIA^DIQQQ
IF $DATA(^DD(DI,"GR"))
KILL Y
SET Y=-1
IF $LENGTH(X)<31
Begin DoDot:1
+5 NEW I,DIGRP,DTOUT,DUOUT,DIRUT,DIROUT,DIYN
SET DIGRP=X
SET DIYN=0
+6 IF $DATA(^DD(DI,"GR",DIGRP))
Begin DoDot:2
+7 NEW X,I
+8 FOR I=0:0
SET I=$ORDER(^DD(DI,"GR",DIGRP,I))
IF 'I
QUIT
IF $GET(^DD(DI,I,0))]""
SET I(I)=I_U_$PIECE(^(0),U)
+9 IF '$ORDER(I(0))
QUIT
+10 WRITE !!,"Fields in Group: ",DIGRP
FOR I=0:0
SET I=$ORDER(I(I))
IF 'I
QUIT
WRITE !,?2,I,?10,$PIECE(I(I),U,2)
+11 Begin DoDot:3
+12 NEW X,Y
SET DIR(0)="Y"
SET DIR("A")="Edit this GROUP of fields"
SET DIR("B")="YES"
DO ^DIR
SET DIYN=$SELECT(Y=1:1,$GET(DIRUT):2,1:0)
QUIT
End DoDot:3
IF DIYN'=1
QUIT
+13 MERGE Y=I
SET Y=0
QUIT
End DoDot:2
IF DIYN
QUIT
FOR
SET DIGRP=$ORDER(^DD(DI,"GR",DIGRP))
IF $EXTRACT(DIGRP,1,$LENGTH(X))'=X
QUIT
Begin DoDot:2
End DoDot:2
IF DIYN
QUIT
+14 QUIT
End DoDot:1
+15 KILL DIYN
GOTO X^DIA3
+16 ;
F SET X=$PIECE(^DD(DI,0),U)
IF F
IF X="FIELD"
SET X=$ORDER(^(0,"NM",0))_" "_X
+1 QUIT
+2 ;
X ;
+1 WRITE $CHAR(7),"??"
DO DICS
2 ;
+1 IF '$DATA(DR(F+1,DI))
GOTO 1
DO F
WRITE !?F*3,"THEN EDIT "_X
IF DB
GOTO ED
R READ ": ",X:DTIME
IF '$TEST
WRITE $CHAR(7)
SET X=U
SET DTOUT=1
+1 IF X]""
GOTO L
UP ;
+1 IF 'F
GOTO ^DIA1
KILL I(L),J(L)
SET L=L-1
IF '$DATA(J(L))
FOR L=L-99:1
IF '$DATA(J(L+1))
QUIT
+2 IF DB
SET DB=DB(F)
SET DIARTLVL=DIARTLVL(F)
SET DIAO=DIAO(F)
SET DIAT=$SELECT(DIAO<0:"",DIAO:$GET(^DIE(DIAA,"DR",DIARTLVL,J(L),DIAO)),$DATA(^DIE(DIAA,"DR",DIARTLVL,J(L))):^(J(L)),1:"")
+3 SET DIARLVL=DIARLVL(F)
SET DIAP=DIAP(F)
SET DI=J(L)
SET F=F-1
GOTO 2
+4 ;
NDB IF DB
IF DIAO'<0
SET DIAO=DIAO+1
IF $DATA(^DIE(DIAA,"DR",DIARLVL,DI,DIAO))
SET DIAT=^(DIAO)
SET DB=1
GOTO GDB
+1 SET DIAO=-1
GOTO R
+2 ;
+3 ;
+4 ;
EN ;Entry point from DIB routine
+1 NEW DIARTLVL,DIARLVL,DIAL,DIESP,DRR
IF '$DATA(DISYS)
DO OS^DII
FILETOP ;Enter from DIA3 when there is a file jump
DO DICS
DOWN ;Find 2.01 if we have already gone down to DR(2,DI) -- WPB-0804-30857
SET F=F+1
SET DIAL(F)=+$GET(DIAL)
SET DIARLVL(F)=+$GET(DIARLVL)
FOR %=F+1:.01
IF '$DATA(DR(%,DI))
QUIT
+1 IF %["."
SET @DRR=@DRR_U_%_";"
SET DIAP=DIAP+1
SET DIARLVL=%
+2 SET DIAP(F)=DIAP
SET DIAP=0
+3 IF DB
SET DIARTLVL(F)=DIARTLVL
Begin DoDot:1
+4 SET %=$PIECE(DIAT,";",DB)
IF %?1"^"1.NP
SET DIARTLVL=$PIECE(%,U,2)
SET DB=DB+1
QUIT
+5 FOR DIARTLVL=F+1:.01
IF '$DATA(DIARTLVL(DIARTLVL,DI))
QUIT
End DoDot:1
SET DB(F)=DB
SET DB=1
SET DIAO(F)=DIAO
SET DIAO=0
SET DIAT=$GET(^DIE(DIAA,"DR",DIARTLVL,DI))
SET DIARTLVL(DIARTLVL,DI)=""
+6 IF $PIECE(^DD(DI,.01,0),U,2)'["W"
GOTO 1
IF L#100=0
GOTO 1
GOTO UP
+7 ;
DICS ;
+1 SET DIC("S")="I Y>.001,$P">P(^(0),U,2)'[""C"""_$SELECT(DUZ(0)="@":"",1:",$P">P(^(0),U,2)'[""K""")_" Q:'$D(^(9)) I ^(9)'=U"_$SELECT(DUZ(0)'="@":" F DW=1:1:$L(^(9)) I DUZ(0)[$E(^(9),DW) Q",1:"")
QUIT
+2 ;
P ;
+1 SET DRS=99
SET Y=X
DO DB
GOTO 2
+2 ;
SET SET Y=+Y_DV
DB ;
+1 IF DB
IF 'DSC
SET DB=DB+1
D ;takes 'Y' and puts it into 'DR' array -- Also called from DIA3
+1 NEW %,B
+2 SET (DRR,B)=$NAME(DR(DIARLVL,DI))
SET %=$ORDER(@DRR@(""),-1)
+3 IF %
SET DRR=$NAME(@DRR@(%))
+4 IF '$DATA(@DRR)
SET @DRR=""
SET DIAP=0
+5 IF '$TEST
IF $LENGTH(Y)+$LENGTH(@DRR)>230
SET DRR=$NAME(@B@(%+1))
SET DIAP=DIAP\1000+1*1000
SET @DRR=""
+6 SET @DRR=@DRR_Y_";"
SET DRS=$GET(DRS)+1
+7 SET DIAP=DIAP+1
DIAB IF $DATA(DIAB)
SET ^UTILITY($JOB,DIAP#1000,DIARLVL-1,DI,DIAP\1000)=DIAB
KILL DIAB
+1 QUIT
+2 ;
RW IF $LENGTH(Y)>19
DO RW^DIR2
QUIT
+1 WRITE "// "
READ X:DTIME
IF '$TEST
SET X=U
SET DTOUT=1
WRITE $CHAR(7)