DVBHCE ; GENERATED FROM 'DVBHINQ UPDATE' INPUT TEMPLATE(#960), FILE 2;07/06/22
D DE G BEGIN
DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
I $D(^(.32)) S %Z=^(.32) S %=$P(%Z,U,3) S:%]"" DE(56)=% S %=$P(%Z,U,4) S:%]"" DE(24)=% S %=$P(%Z,U,5) S:%]"" DE(22)=% S %=$P(%Z,U,6) S:%]"" DE(20)=% S %=$P(%Z,U,7) S:%]"" DE(21)=% S %=$P(%Z,U,8) S:%]"" DE(25)=% S %=$P(%Z,U,9) S:%]"" DE(37)=%
I S %=$P(%Z,U,10) S:%]"" DE(36)=% S %=$P(%Z,U,11) S:%]"" DE(34)=% S %=$P(%Z,U,12) S:%]"" DE(35)=% S %=$P(%Z,U,13) S:%]"" DE(38)=% S %=$P(%Z,U,14) S:%]"" DE(50)=% S %=$P(%Z,U,15) S:%]"" DE(49)=% S %=$P(%Z,U,16) S:%]"" DE(47)=%
I S %=$P(%Z,U,17) S:%]"" DE(48)=% S %=$P(%Z,U,18) S:%]"" DE(51)=% S %=$P(%Z,U,19) S:%]"" DE(32)=% S %=$P(%Z,U,20) S:%]"" DE(45)=%
K %Z Q
;
W W !?DL+DL-2,DLB_": "
Q
O D W W Y W:$X>45 !?9
I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 K X S X("FIELD")=DIFLD,X("FILE")=DP W " ("_$$EZBLD^DIALOG(710,.X)_")" K X S X="" Q ;**
TR Q:DV["K"&(DUZ(0)'="@") R X:DTIME E S (DTOUT,X)=U W $C(7)
Q
A K DQ(DQ) S DQ=DQ+1
B G @DQ
RE G A:DV["K"&(DUZ(0)'["@"),PR:$D(DE(DQ)) D W,TR
N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
RD G QS:X?."?" I X["^" D D G ^DIE17
I X="@" D D G Z^DIE2
I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W " "_X
T G M^DIE17:DV,^DIE3:DV["V",X:X'?.ANP
I DV["t" D G UNIQ ;EXTENSIBLE DATA TYPES ;p21
.X $S($D(DB(DQ)):$$VALEXTS^DIETLIBF(DP,DIFLD),1:$$VALEXT^DIETLIBF(DP,DIFLD)) K DIPA
I DV["S" D SET^DIED G V:'DDER K DDER G X ;p22
P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
V D @("X"_DQ) K YS
UNIQ I DV["U",$D(X),DIFLD=.01 K % M %=@(DIE_"""B"",X)") K %(DA) K:$O(%(0)) X
Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
S X="?BAD"
QS S DZ=X D D,QQ^DIEQ G B
D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
I DG["t" X $$OUTPUT^DIETLIBF(DP,DIFLD) K DIPA G RP ;p21
R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") I %]"" S Y=$S($G(DUZ("LANG"))'>1:%,'DIFLD:%,1:$$SET^DIQ(DP,DIFLD,Y))
RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
I I DV'["I",DV'["#" G RD
D E^DIE0 G RD:$D(X),PR
Q
SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
E K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
Q
NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
BEGIN S DNM="DVBHCE",DQ=1
N DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR K DIEFIRE,DIEBADK S DIEZTMP=$$GETTMP^DIKC1("DIEZ")
M DIEZAR=^DIE(960,"AR") S DICRREC="TRIG^DIE17"
S:$D(DTIME)[0 DTIME=300 S D0=DA,DIIENS=DA_",",DIEZ=960,U="^"
1 S DQ=2 ;@101
2 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 D X2 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X2 W @$S('$D(IOF):"#",IOF="":"#",1:IOF),! K ^UTILITY($J) D ^DVBHSVER
Q
3 S DQ=4 ;@7
4 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=4 D X4 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X4 D Q^DVBHUTIL
Q
5 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=5 D X5 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X5 S DIE("NO^")=""
Q
6 S DQ=7 ;@1001
7 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=7 D X7 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X7 D ^DVBHS1 S Y="@5"
Q
8 S DQ=9 ;@1
9 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=9 D X9 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X9 D ^DVBHS2 S Y="@5" W !
Q
10 S DQ=11 ;@2
11 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=11 D X11 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X11 D ^DVBHS3 S Y="@5"
Q
12 S DQ=13 ;@3
13 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=13 D X13 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X13 D ^DVBHS4 S Y="@5"
Q
14 S DQ=15 ;@1006
15 S DQ=16 ;@30
16 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=16 D X16 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X16 I Z2'[1 S Y="@32"
Q
17 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=17 D X17 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X17 I $O(^DPT(D0,.3216,"B",0)) W !!,*7,?17,DVBON,"Authoritative data, can't edit <RET>",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S Y="@33"
Q
18 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=18 D X18 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X18 S DVBSCR=1 D ^DVBHS4 W !,?34,DVBON,"[LAST]",DVBOFF X DVBLIT1
Q
19 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=19 D X19 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X19 S DVBJC=$S('$D(^DPT(DFN,.32)):"",1:$P(^(0),U,5))
Q
20 S DW=".32;6",DV="RDX",DU="",DIFLD=.326,DLB="L-EOD"
S DE(DW)="C20^DVBHCE",DE(DW,"INDEX")=1
G RE
C20 G C20S:$D(DE(20))[0 K DB
S X=DE(20),DIC=DIE
;
S X=DE(20),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DE(20),DIC=DIE
D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
C20S S X="" G:DG(DQ)=X C20F1 K DB
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DG(DQ),DIC=DIE
D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
C20F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=640 S DIEZRXR(2,DIXR)=""
Q
X20 S %DT="E",%DT(0)=-DT D ^%DT K %DT S X=Y K:Y<1 X I $D(X) S DFN=DA D SV^DGLOCK I $D(X) K:'$$VALMSE^DGRPMS(DFN,X,0,"MSL") X I $D(X) S DGFRDT=X I $D(^DG(43,1)) S SD1=1 D POS^DGINP
Q
;
21 D:$D(DG)>9 F^DIE17,DE S DQ=21,DW=".32;7",DV="RDX",DU="",DIFLD=.327,DLB="L-RAD"
S DE(DW)="C21^DVBHCE",DE(DW,"INDEX")=1
G RE
C21 G C21S:$D(DE(21))[0 K DB
S X=DE(21),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DE(21),DIC=DIE
D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
C21S S X="" G:DG(DQ)=X C21F1 K DB
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DG(DQ),DIC=DIE
D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
C21F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=303,640 S DIEZRXR(2,DIXR)=""
Q
X21 S %DT="E",%DT(0)=-DT D ^%DT K %DT S X=Y K:Y<1 X I $D(X) S DFN=DA D SV^DGLOCK I $D(X) K:'$$VALMSE^DGRPMS(DFN,X,1,"MSL") X I $D(X),$D(^DG(43,1)) S SD1=1 D PS^DGINP
Q
;
22 D:$D(DG)>9 F^DIE17,DE S DQ=22,DW=".32;5",DV="P23'X",DU="",DIFLD=.325,DLB="L-Bran.. Ser."
S DE(DW)="C22^DVBHCE",DE(DW,"INDEX")=1
S DU="DIC(23,"
G RE
C22 G C22S:$D(DE(22))[0 K DB
S X=DE(22),DIC=DIE
S A1B2TAG="PAT" D ^A1B2XFR
S X=DE(22),DIC=DIE
I $P($G(^DPT(DA,.321)),U,14)]"" D FVP^DGRPMS
S X=DE(22),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DE(22),DIC=DIE
X "S DGXRF=.325 D ^DGDDC Q"
C22S S X="" G:DG(DQ)=X C22F1 K DB
S X=DG(DQ),DIC=DIE
S A1B2TAG="PAT" D ^A1B2XFR
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DG(DQ),DIC=DIE
;
C22F1 N X,X1,X2 S DIXR=408 D C22X1(U) K X2 M X2=X D C22X1("O") K X1 M X1=X
D
. N DIEXARR M DIEXARR=X S DIEZCOND=1
. S X=X2(1)=""
. S DIEZCOND=$G(X) K X M X=DIEXARR Q:'DIEZCOND
. D DELMSE^DGRPMS(DA,1)
G C22F2
C22X1(DION) K X
S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.325,DION),$P($G(^DPT(DA,.32)),U,5))
S X=$G(X(1))
Q
C22F2 Q
X22 S DFN=DA K:X=$O(^DIC(23,"B","B.E.C.","")) X I $D(X) D SV^DGLOCK S DGCOMBR=$G(Y) Q
Q
;
23 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=23 D X23 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X23 I X'=DVBJC S DVBJ2=1
Q
24 D:$D(DG)>9 F^DIE17,DE S DQ=24,DW=".32;4",DV="RP25'X",DU="",DIFLD=.324,DLB="L-Char. Ser."
S DE(DW)="C24^DVBHCE"
S DU="DIC(25,"
G RE
C24 G C24S:$D(DE(24))[0 K DB
S X=DE(24),DIC=DIE
D EVENT^IVMPLOG(DA)
C24S S X="" G:DG(DQ)=X C24F1 K DB
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
C24F1 Q
X24 S DFN=DA I $D(X) D SV^DGLOCK Q
Q
;
25 D:$D(DG)>9 F^DIE17,DE S DQ=25,DW=".32;8",DV="FX",DU="",DIFLD=.328,DLB="L-Ser. Num."
S DE(DW)="C25^DVBHCE"
G RE
C25 G C25S:$D(DE(25))[0 K DB
S X=DE(25),DIC=DIE
D EVENT^IVMPLOG(DA)
C25S S X="" G:DG(DQ)=X C25F1 K DB
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
C25F1 Q
X25 S DFN=DA D SV^DGLOCK I $D(X) S:X?1"SS".E L=$S($D(^DPT(DA,0)):$P(^(0),U,9),1:X) W:X?1"SS".E " ",L S:X?1"SS".E X=L K:$L(X)>15!($L(X)<1)!'(X?.N) X
I $D(X),X'?.ANP K X
Q
;
26 S DQ=27 ;@32
27 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=27 D X27 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X27 I Z2'[2 S Y="@31"
Q
28 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=28 D X28 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X28 I $O(^DPT(D0,.3216,"B",0)) W !!,*7,?17,DVBON,"Authoritative data, can't edit <RET>",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S Y="@33"
Q
29 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=29 D X29 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X29 I '$D(^DPT(D0,.32)) W !!,*7,?17,DVBON,"No Last episode can't edit NTLast <RET>",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S Y="@33"
Q
30 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=30 D X30 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X30 I $P(^DPT(D0,.32),U,6)="" W !!,*7,?17,DVBON,"No last episode can't edit NTLast <RET>",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S Y="@33"
Q
31 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=31 D X31 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X31 S DVBSCR=1 D ^DVBHS4 W !,?34,DVBON,"[NTLAST]",DVBOFF X DVBLIT1
Q
32 D:$D(DG)>9 F^DIE17,DE S DQ=32,DW=".32;19",DV="RSX",DU="",DIFLD=.3285,DLB="Service NTL Episode"
S DE(DW)="C32^DVBHCE"
S DU="Y:YES;N:NO;"
G RE
C32 G C32S:$D(DE(32))[0 K DB
S X=DE(32),DIC=DIE
;
S X=DE(32),DIC=DIE
;
S X=DE(32),DIC=DIE
X ^DD(2,.3285,1,3,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.32)):^(.32),1:"") S X=$P(Y(1),U,10),X=X S DIU=X K Y S X="" S DIH=$G(^DPT(DIV(0),.32)),DIV=X S $P(^(.32),U,10)=DIV,DIH=2,DIG=.3291 D ^DICR
C32S S X="" G:DG(DQ)=X C32F1 K DB
S X=DG(DQ),DIC=DIE
X "I X'=""Y"" S DGXRF=.3285 D ^DGDDC Q"
S X=DG(DQ),DIC=DIE
X ^DD(2,.3285,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.32)):^(.32),1:"") S X=$P(Y(1),U,20),X=X S DIU=X K Y S X=DIV S X="N" X ^DD(2,.3285,1,2,1.4)
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S Y(1)=$C(59)_$P($G(^DD(2,.3285,0)),U,3) S X=$P($P(Y(1),$C(59)_Y(0)_":",2),$C(59))'="YES" I X S X=DIV S Y(1)=$S($D(^DPT(D0,.32)):^(.32),1:"") S X=$P(Y(1),U,10),X=X S DIU=X K Y S X="" X ^DD(2,.3285,1,3,1.4)
C32F1 Q
X32 S DFN=DA D SV^DGLOCK
Q
;
33 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=33 D X33 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X33 I $P(^DPT(D0,.32),U,19)'="Y" S Y="@31"
Q
34 D:$D(DG)>9 F^DIE17,DE S DQ=34,DW=".32;11",DV="RDX",DU="",DIFLD=.3292,DLB="NTL-EOD"
S DE(DW)="C34^DVBHCE",DE(DW,"INDEX")=1
G RE
C34 G C34S:$D(DE(34))[0 K DB
S X=DE(34),DIC=DIE
;
S X=DE(34),DIC=DIE
D EVENT^IVMPLOG(DA)
C34S S X="" G:DG(DQ)=X C34F1 K DB
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
C34F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=641 S DIEZRXR(2,DIXR)=""
Q
X34 S %DT="E",%DT(0)=-DT D ^%DT K %DT S X=Y K:Y<1 X I $D(X) S DFN=DA D SER1^DGLOCK I $D(X) K:'$$VALMSE^DGRPMS(DFN,X,0,"MSNTL") X I $D(X) S DGFRDT=X I $D(^DG(43,1)) S SD1=2 D POS^DGINP
Q
;
35 D:$D(DG)>9 F^DIE17,DE S DQ=35,DW=".32;12",DV="RDX",DU="",DIFLD=.3293,DLB="NTL-RAD"
S DE(DW)="C35^DVBHCE",DE(DW,"INDEX")=1
G RE
C35 G C35S:$D(DE(35))[0 K DB
S X=DE(35),DIC=DIE
D EVENT^IVMPLOG(DA)
C35S S X="" G:DG(DQ)=X C35F1 K DB
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
C35F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=641 S DIEZRXR(2,DIXR)=""
Q
X35 S %DT="E",%DT(0)=-DT D ^%DT K %DT S X=Y K:Y<1 X I $D(X) S DFN=DA D SER1^DGLOCK I $D(X) K:'$$VALMSE^DGRPMS(DFN,X,1,"MSNTL") X I $D(X),$D(^DG(43,1)) S SD1=2 D PS^DGINP
Q
;
36 D:$D(DG)>9 F^DIE17,DE S DQ=36,DW=".32;10",DV="P23'X",DU="",DIFLD=.3291,DLB="NTL-Bran. Ser."
S DE(DW)="C36^DVBHCE",DE(DW,"INDEX")=1
S DU="DIC(23,"
G RE
C36 G C36S:$D(DE(36))[0 K DB
S X=DE(36),DIC=DIE
I $P($G(^DPT(DA,.321)),U,14)]"" D FVP^DGRPMS
S X=DE(36),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DE(36),DIC=DIE
X "S DGXRF=.3291 D ^DGDDC Q"
C36S S X="" G:DG(DQ)=X C36F1 K DB
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DG(DQ),DIC=DIE
;
C36F1 N X,X1,X2 S DIXR=409 D C36X1(U) K X2 M X2=X D C36X1("O") K X1 M X1=X
D
. N DIEXARR M DIEXARR=X S DIEZCOND=1
. S X=X2(1)=""
. S DIEZCOND=$G(X) K X M X=DIEXARR Q:'DIEZCOND
. D DELMSE^DGRPMS(DA,2)
G C36F2
C36X1(DION) K X
S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.3291,DION),$P($G(^DPT(DA,.32)),U,10))
S X=$G(X(1))
Q
C36F2 Q
X36 S DFN=DA K:X=$O(^DIC(23,"B","B.E.C.","")) X I $D(X) D SER1^DGLOCK S DGCOMBR=$G(Y) Q
Q
;
37 D:$D(DG)>9 F^DIE17,DE S DQ=37,DW=".32;9",DV="RP25'X",DU="",DIFLD=.329,DLB="NTL-Char. Ser."
S DE(DW)="C37^DVBHCE"
S DU="DIC(25,"
G RE
C37 G C37S:$D(DE(37))[0 K DB
S X=DE(37),DIC=DIE
D EVENT^IVMPLOG(DA)
C37S S X="" G:DG(DQ)=X C37F1 K DB
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
C37F1 Q
X37 S DFN=DA D SER1^DGLOCK
Q
;
38 D:$D(DG)>9 F^DIE17,DE S DQ=38,DW=".32;13",DV="FX",DU="",DIFLD=.3294,DLB="NTL-Ser. Num."
S DE(DW)="C38^DVBHCE"
G RE
C38 G C38S:$D(DE(38))[0 K DB
S X=DE(38),DIC=DIE
D EVENT^IVMPLOG(DA)
C38S S X="" G:DG(DQ)=X C38F1 K DB
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
C38F1 Q
X38 S DFN=DA D SER1^DGLOCK I $D(X) S:X?1"SS".E L=$S($D(^DPT(DA,0)):$P(^(0),U,9),1:X) W:X?1"SS".E " ",L S:X?1"SS".E X=L K:$L(X)>15!($L(X)<1)!'(X?.N) X
I $D(X),X'?.ANP K X
Q
;
39 S DQ=40 ;@31
40 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=40 D X40 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X40 I Z2'[3 S Y="@33"
Q
41 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=41 D X41 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X41 I $O(^DPT(D0,.3216,"B",0)) W !!,*7,?17,DVBON,"Authoritative data, can't edit <RET>",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S Y="@33"
Q
42 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=42 D X42 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X42 I '$D(^DPT(D0,.32)) W !!,*7,?17,DVBON,"No NTLast episode can't edit NNTLast <RET>",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S Y="@33"
Q
43 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=43 D X43 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X43 I $P(^DPT(D0,.32),U,19)'="Y" W !!,*7,?17,DVBON,"No NTLast episode can't edit NNTLast <RET>.",DVBOFF X DVBLIT1 R DVBZ:DTIME K DVBZ S Y="@33"
Q
44 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=44 D X44 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X44 S DVBSCR=1 D ^DVBHS4 W !,?34,DVBON,"[NNTLAST]",DVBOFF X DVBLIT1
Q
45 D:$D(DG)>9 F^DIE17,DE S DQ=45,DW=".32;20",DV="RSX",DU="",DIFLD=.32945,DLB="Service NNTL Episode"
S DE(DW)="C45^DVBHCE"
S DU="Y:YES;N:NO;"
G RE
C45 G C45S:$D(DE(45))[0 K DB
S X=DE(45),DIC=DIE
;
S X=DE(45),DIC=DIE
X ^DD(2,.32945,1,2,2.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.32)):^(.32),1:"") S X=$P(Y(1),U,15),X=X S DIU=X K Y S X="" S DIH=$G(^DPT(DIV(0),.32)),DIV=X S $P(^(.32),U,15)=DIV,DIH=2,DIG=.3296 D ^DICR
C45S S X="" G:DG(DQ)=X C45F1 K DB
S X=DG(DQ),DIC=DIE
X "I X'=""Y"" S DGXRF=.32945 D ^DGDDC Q"
S X=DG(DQ),DIC=DIE
X ^DD(2,.32945,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,.32)):^(.32),1:"") S X=$P(Y(1),U,15),X=X S DIU=X K Y S X="" S DIH=$G(^DPT(DIV(0),.32)),DIV=X S $P(^(.32),U,15)=DIV,DIH=2,DIG=.3296 D ^DICR
C45F1 Q
X45 S DFN=DA D SV^DGLOCK I "N"'[$G(X),$D(^DPT(DFN,.32)),$P(^(.32),U,19)'="Y" W !?4,*7,"Other Periods of service are not indicated...NO EDITING!" K X
Q
;
46 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=46 D X46 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X46 I $P(^DPT(D0,.32),U,20)'="Y" S Y="@33"
Q
47 D:$D(DG)>9 F^DIE17,DE S DQ=47,DW=".32;16",DV="RDX",DU="",DIFLD=.3297,DLB="NNTL-EOD"
S DE(DW)="C47^DVBHCE",DE(DW,"INDEX")=1
G RE
C47 G C47S:$D(DE(47))[0 K DB
S X=DE(47),DIC=DIE
D EVENT^IVMPLOG(DA)
C47S S X="" G:DG(DQ)=X C47F1 K DB
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
C47F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=642 S DIEZRXR(2,DIXR)=""
Q
X47 S %DT="E",%DT(0)=-DT D ^%DT K %DT S X=Y K:Y<1 X I $D(X) S DFN=DA D SER2^DGLOCK I $D(X) K:'$$VALMSE^DGRPMS(DFN,X,0,"MSNNTL") X I $D(X) S DGFRDT=X I $D(^DG(43,1)) S SD1=3 D POS^DGINP
Q
;
48 D:$D(DG)>9 F^DIE17,DE S DQ=48,DW=".32;17",DV="RDX",DU="",DIFLD=.3298,DLB="NNTL-RAD"
S DE(DW)="C48^DVBHCE",DE(DW,"INDEX")=1
G RE
C48 G C48S:$D(DE(48))[0 K DB
S X=DE(48),DIC=DIE
D EVENT^IVMPLOG(DA)
C48S S X="" G:DG(DQ)=X C48F1 K DB
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
C48F1 S DIEZRXR(2,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
F DIXR=642 S DIEZRXR(2,DIXR)=""
Q
X48 S %DT="E",%DT(0)=-DT D ^%DT K %DT S X=Y K:Y<1 X I $D(X) S DFN=DA D SER2^DGLOCK I $D(X) K:'$$VALMSE^DGRPMS(DFN,X,1,"MSNNTL") X I $D(X),$D(^DG(43,1)) S SD1=3 D PS^DGINP
Q
;
49 D:$D(DG)>9 F^DIE17,DE S DQ=49,DW=".32;15",DV="P23'X",DU="",DIFLD=.3296,DLB="NNTL-Bran. Ser."
S DE(DW)="C49^DVBHCE",DE(DW,"INDEX")=1
S DU="DIC(23,"
G RE
C49 G C49S:$D(DE(49))[0 K DB
S X=DE(49),DIC=DIE
I $P($G(^DPT(DA,.321)),U,14)]"" D FVP^DGRPMS
S X=DE(49),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DE(49),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.3291)):^(.3291),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y S X="" S DIH=$G(^DPT(DIV(0),.3291)),DIV=X S $P(^(.3291),U,3)=DIV,DIH=2,DIG=.32913 D ^DICR
S X=DE(49),DIC=DIE
X "S DGXRF=.3296 D ^DGDDC Q"
C49S S X="" G:DG(DQ)=X C49F1 K DB
S X=DG(DQ),DIC=DIE
;
S X=DG(DQ),DIC=DIE
D EVENT^IVMPLOG(DA)
S X=DG(DQ),DIC=DIE
K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.3291)):^(.3291),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y S X="" S DIH=$G(^DPT(DIV(0),.3291)),DIV=X S $P(^(.3291),U,3)=DIV,DIH=2,DIG=.32913 D ^DICR
S X=DG(DQ),DIC=DIE
;
C49F1 N X,X1,X2 S DIXR=410 D C49X1(U) K X2 M X2=X D C49X1("O") K X1 M X1=X
D
. N DIEXARR M DIEXARR=X S DIEZCOND=1
. S X=X2(1)=""
. S DIEZCOND=$G(X) K X M X=DIEXARR Q:'DIEZCOND
. D DELMSE^DGRPMS(DA,3)
G C49F2
C49X1(DION) K X
S X(1)=$G(@DIEZTMP@("V",2,DIIENS,.3296,DION),$P($G(^DPT(DA,.32)),U,15))
S X=$G(X(1))
Q
C49F2 Q
X49 S DFN=DA K:X=$O(^DIC(23,"B","B.E.C.","")) X I $D(X) D SER2^DGLOCK S DGCOMBR=$G(Y) Q
Q
;
50 D:$D(DG)>9 F^DIE17,DE S DQ=50,DW=".32;14",DV="RP25'X",DU="",DIFLD=.3295,DLB="NNTL-Char. Ser."
S DE(DW)="C50^DVBHCE"
S DU="DIC(25,"
G RE
C50 G C50S:$D(DE(50))[0 K DB
S X=DE(50),DIC=DIE
D EVENT^IVMPLOG(DA)
C50S S X="" G:DG(DQ)=X C50F1 K DB
D ^DVBHCE1
C50F1 Q
X50 S DFN=DA D SER2^DGLOCK
Q
;
51 D:$D(DG)>9 F^DIE17,DE S DQ=51,DW=".32;18",DV="FX",DU="",DIFLD=.3299,DLB="NNTL-Ser. Num."
S DE(DW)="C51^DVBHCE"
G RE
C51 G C51S:$D(DE(51))[0 K DB
S X=DE(51),DIC=DIE
D EVENT^IVMPLOG(DA)
C51S S X="" G:DG(DQ)=X C51F1 K DB
D ^DVBHCE2
C51F1 Q
X51 S DFN=DA D SER2^DGLOCK I $D(X) S:X?1"SS".E L=$S($D(^DPT(DA,0)):$P(^(0),U,9),1:X) W:X?1"SS".E " ",L S:X?1"SS".E X=L K:$L(X)>15!($L(X)<1)!'(X?.N) X
I $D(X),X'?.ANP K X
Q
;
52 S DQ=53 ;@33
53 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=53 D X53 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X53 I Z2'[4 S Y="@3"
Q
54 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=54 D X54 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X54 S DVBSCR=1 D ^DVBHS4
Q
55 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=55 D X55 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X55 S DVBJC2=$S($D(^DPT(D0,.32)):$P(^(.32),U,3),1:"")
Q
56 D:$D(DG)>9 F^DIE17,DE S DQ=56,DW=".32;3",DV="*P21'Xa",DU="",DIFLD=.323,DLB=$$LABEL^DIALOGZ(DP,DIFLD)
S DE(DW)="C56^DVBHCE"
S DU="DIC(21,"
G RE
C56 G C56S:$D(DE(56))[0 K DB
D ^DVBHCE3
C56S S X="" G:DG(DQ)=X C56F1 K DB
D ^DVBHCE4
C56F1 Q
X56 S DFN=DA D POS^DGLOCK1
Q
;
57 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=57 D X57 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X57 I X'=DVBJC2 S DVBJ2=1
Q
58 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=58 D X58 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X58 K DVBJC2
Q
59 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=59 D X59 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X59 S Y="@3"
Q
60 S DQ=61 ;@104
61 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=61 D X61 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X61 D ^DVBHS5 S Y="@5" K DXS
Q
62 S DQ=63 ;@204
63 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=63 D X63 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X63 I Z2'[1 S Y="@205"
Q
64 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=64 D X64 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
X64 S DVBSCR=1 D ^DVBHS5 S DVBJ2=1
Q
65 D:$D(DG)>9 F^DIE17 G ^DVBHCE5
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBHCE 21621 printed Oct 16, 2024@17:58:46 Page 2
DVBHCE ; GENERATED FROM 'DVBHINQ UPDATE' INPUT TEMPLATE(#960), FILE 2;07/06/22
+1 DO DE
GOTO BEGIN
DE SET DIE="^DPT("
SET DIC=DIE
SET DP=2
SET DL=1
SET DIEL=0
SET DU=""
KILL DG,DE,DB
if $ORDER(^DPT(DA,""))=""
QUIT
+1 IF $DATA(^(.32))
SET %Z=^(.32)
SET %=$PIECE(%Z,U,3)
if %]""
SET DE(56)=%
SET %=$PIECE(%Z,U,4)
if %]""
SET DE(24)=%
SET %=$PIECE(%Z,U,5)
if %]""
SET DE(22)=%
SET %=$PIECE(%Z,U,6)
if %]""
SET DE(20)=%
SET %=$PIECE(%Z,U,7)
if %]""
SET DE(21)=%
SET %=$PIECE(%Z,U,8)
if %]""
SET DE(25)=%
SET %=$PIECE(%Z,U,9)
if %]""
SET DE(37)=%
+2 IF $TEST
SET %=$PIECE(%Z,U,10)
if %]""
SET DE(36)=%
SET %=$PIECE(%Z,U,11)
if %]""
SET DE(34)=%
SET %=$PIECE(%Z,U,12)
if %]""
SET DE(35)=%
SET %=$PIECE(%Z,U,13)
if %]""
SET DE(38)=%
SET %=$PIECE(%Z,U,14)
if %]""
SET DE(50)=%
SET %=$PIECE(%Z,U,15)
if %]""
SET DE(49)=%
SET %=$PIECE(%Z,U,16)
if %]""
SET DE(47)=%
+3 IF $TEST
SET %=$PIECE(%Z,U,17)
if %]""
SET DE(48)=%
SET %=$PIECE(%Z,U,18)
if %]""
SET DE(51)=%
SET %=$PIECE(%Z,U,19)
if %]""
SET DE(32)=%
SET %=$PIECE(%Z,U,20)
if %]""
SET DE(45)=%
+4 KILL %Z
QUIT
+5 ;
W WRITE !?DL+DL-2,DLB_": "
+1 QUIT
O DO W
WRITE Y
if $X>45
WRITE !?9
+1 IF $LENGTH(Y)>19
IF 'DV
IF DV'["I"
IF (DV["F"!(DV["K"))
GOTO RW^DIR2
+2 ;**
if Y]""
WRITE "// "
IF 'DV
IF DV["I"
IF $DATA(DE(DQ))#2
KILL X
SET X("FIELD")=DIFLD
SET X("FILE")=DP
WRITE " ("_$$EZBLD^DIALOG(710,.X)_")"
KILL X
SET X=""
QUIT
TR if DV["K"&(DUZ(0)'="@")
QUIT
READ X:DTIME
IF '$TEST
SET (DTOUT,X)=U
WRITE $CHAR(7)
+1 QUIT
A KILL DQ(DQ)
SET DQ=DQ+1
B GOTO @DQ
RE if DV["K"&(DUZ(0)'["@")
GOTO A
if $DATA(DE(DQ))
GOTO PR
DO W
DO TR
N IF X=""
if $DATA(^DD("KEY","F",DP,DIFLD))
GOTO NKEY
if DV'["R"
GOTO A
if 'DV
GOTO X
if D'>0
GOTO X
GOTO A
RD if X?."?"
GOTO QS
IF X["^"
DO D
GOTO ^DIE17
+1 IF X="@"
DO D
GOTO Z^DIE2
+2 IF X=" "
IF DV["d"
IF DV'["P"
IF $DATA(^DISV(DUZ,"DIE",DLB))
SET X=^(DLB)
IF DV'["D"
IF DV'["S"
WRITE " "_X
T if DV
GOTO M^DIE17
if DV["V"
GOTO ^DIE3
if X'?.ANP
GOTO X
+1 ;EXTENSIBLE DATA TYPES ;p21
IF DV["t"
Begin DoDot:1
+2 XECUTE $SELECT($DATA(DB(DQ)):$$VALEXTS^DIETLIBF(DP,DIFLD),1:$$VALEXT^DIETLIBF(DP,DIFLD))
KILL DIPA
End DoDot:1
GOTO UNIQ
+3 ;p22
IF DV["S"
DO SET^DIED
if 'DDER
GOTO V
KILL DDER
GOTO X
P IF DV["P"
SET DIC=U_DU
SET DIC(0)=$EXTRACT("EN",$DATA(DB(DQ))+1)_"M"_$EXTRACT("L",DV'["'")
if DIC(0)["L"
SET DLAYGO=+$PIECE(DV,"P",2)
if DV["*"
GOTO AST^DIED
DO NOSCR^DIED
SET X=+Y
SET DIC=DIE
if X<0
GOTO X
+1 if DV'["N"
GOTO V
DO D
IF $LENGTH($PIECE(X,"."))>24
KILL X
GOTO Z
+2 IF $PIECE(DQ(DQ),U,5)'["$"
IF X?.1"-".N.1".".N
IF $PIECE(DQ(DQ),U,5,99)["+X'=X"
SET X=+X
V DO @("X"_DQ)
KILL YS
UNIQ IF DV["U"
IF $DATA(X)
IF DIFLD=.01
KILL %
MERGE %=@(DIE_"""B"",X)")
KILL %(DA)
if $ORDER(%(0))
KILL X
Z KILL DIC("S"),DLAYGO
IF $DATA(X)
IF X'=U
if $GET(DE(DW,"INDEX"))
DO SAVEVALS
if '$$KEYCHK
GOTO UNIQFERR^DIE17
SET DG(DW)=X
if DV["d"
SET ^DISV(DUZ,"DIE",DLB)=X
GOTO A
X if '$DATA(ZTQUEUED)
WRITE $CHAR(7),"??"
IF $DATA(DB(DQ))
GOTO Z^DIE17
+1 SET X="?BAD"
QS SET DZ=X
DO D
DO QQ^DIEQ
GOTO B
D SET D=DIFLD
SET DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$PIECE($TEXT(@("X"_DQ))," ",2,99)
QUIT
Y IF '$DATA(DE(DQ))
DO O
if "@"'[X
GOTO RD
if DV'["R"&(X="@")
GOTO A
if X="@"
GOTO X
SET X=Y
GOTO N
PR SET DG=DV
SET Y=DE(DQ)
SET X=DU
IF $DATA(DQ(DQ,2))
XECUTE DQ(DQ,2)
GOTO RP
+1 ;p21
IF DG["t"
XECUTE $$OUTPUT^DIETLIBF(DP,DIFLD)
KILL DIPA
GOTO RP
R IF DG["P"
IF @("$D(^"_X_"0))")
SET X=+$PIECE(^(0),U,2)
if '$DATA(^(Y,0))
GOTO RP
SET Y=$PIECE(^(0),U)
SET X=$PIECE(^DD(X,.01,0),U,3)
SET DG=$PIECE(^(0),U,2)
GOTO R
+1 IF DG["V"
IF +Y
IF $PIECE(Y,";",2)["("
IF $DATA(@(U_$PIECE(Y,";",2)_"0)"))
SET X=+$PIECE(^(0),U,2)
if '$DATA(^(+Y,0))
GOTO RP
SET Y=$PIECE(^(0),U)
IF $DATA(^DD(+X,.01,0))
SET DG=$PIECE(^(0),U,2)
SET X=$PIECE(^(0),U,3)
GOTO R
+2 if DG["D"
XECUTE ^DD("DD")
IF DG["S"
SET %=$PIECE($PIECE(";"_X,";"_Y_":",2),";")
IF %]""
SET Y=$SELECT($GET(DUZ("LANG"))'>1:%,'DIFLD:%,1:$$SET^DIQ(DP,DIFLD,Y))
RP DO O
IF X=""
SET X=DE(DQ)
if 'DV
GOTO A
if DC<2
GOTO A
GOTO N^DIE17
I IF DV'["I"
IF DV'["#"
GOTO RD
+1 DO E^DIE0
if $DATA(X)
GOTO RD
GOTO PR
+2 QUIT
SAVEVALS SET @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$GET(DE(DQ))
if $DATA(^("F"))[0
SET ^("F")=$GET(DE(DQ))
+1 IF $DATA(DE(DW,"4/"))
SET @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
+2 IF '$TEST
KILL @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
+3 QUIT
NKEY if '$DATA(ZTQUEUED)
WRITE "?? Required key field"
SET X="?BAD"
GOTO QS
KEYCHK() if $GET(DE(DW,"KEY"))=""
QUIT 1
QUIT @DE(DW,"KEY")
BEGIN SET DNM="DVBHCE"
SET DQ=1
+1 NEW DIEZTMP,DIEZAR,DIEZRXR,DIIENS,DIXR
KILL DIEFIRE,DIEBADK
SET DIEZTMP=$$GETTMP^DIKC1("DIEZ")
+2 MERGE DIEZAR=^DIE(960,"AR")
SET DICRREC="TRIG^DIE17"
+3 if $DATA(DTIME)[0
SET DTIME=300
SET D0=DA
SET DIIENS=DA_","
SET DIEZ=960
SET U="^"
1 ;@101
SET DQ=2
2 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=2
DO X2
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X2 WRITE @$SELECT('$DATA(IOF):"#",IOF="":"#",1:IOF),!
KILL ^UTILITY($JOB)
DO ^DVBHSVER
+1 QUIT
3 ;@7
SET DQ=4
4 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=4
DO X4
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X4 DO Q^DVBHUTIL
+1 QUIT
5 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=5
DO X5
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X5 SET DIE("NO^")=""
+1 QUIT
6 ;@1001
SET DQ=7
7 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=7
DO X7
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X7 DO ^DVBHS1
SET Y="@5"
+1 QUIT
8 ;@1
SET DQ=9
9 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=9
DO X9
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X9 DO ^DVBHS2
SET Y="@5"
WRITE !
+1 QUIT
10 ;@2
SET DQ=11
11 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=11
DO X11
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X11 DO ^DVBHS3
SET Y="@5"
+1 QUIT
12 ;@3
SET DQ=13
13 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=13
DO X13
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X13 DO ^DVBHS4
SET Y="@5"
+1 QUIT
14 ;@1006
SET DQ=15
15 ;@30
SET DQ=16
16 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=16
DO X16
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X16 IF Z2'[1
SET Y="@32"
+1 QUIT
17 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=17
DO X17
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X17 IF $ORDER(^DPT(D0,.3216,"B",0))
WRITE !!,*7,?17,DVBON,"Authoritative data, can't edit <RET>",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET Y="@33"
+1 QUIT
18 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=18
DO X18
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X18 SET DVBSCR=1
DO ^DVBHS4
WRITE !,?34,DVBON,"[LAST]",DVBOFF
XECUTE DVBLIT1
+1 QUIT
19 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=19
DO X19
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X19 SET DVBJC=$SELECT('$DATA(^DPT(DFN,.32)):"",1:$PIECE(^(0),U,5))
+1 QUIT
20 SET DW=".32;6"
SET DV="RDX"
SET DU=""
SET DIFLD=.326
SET DLB="L-EOD"
+1 SET DE(DW)="C20^DVBHCE"
SET DE(DW,"INDEX")=1
+2 GOTO RE
C20 if $DATA(DE(20))[0
GOTO C20S
KILL DB
+1 SET X=DE(20)
SET DIC=DIE
+2 ;
+3 SET X=DE(20)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
+5 SET X=DE(20)
SET DIC=DIE
+6 if ($TEXT(ADGRU^DGRUDD01)'="")
DO ADGRU^DGRUDD01(DA)
C20S SET X=""
if DG(DQ)=X
GOTO C20F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 ;
+3 SET X=DG(DQ)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
+5 SET X=DG(DQ)
SET DIC=DIE
+6 if ($TEXT(ADGRU^DGRUDD01)'="")
DO ADGRU^DGRUDD01(DA)
C20F1 SET DIEZRXR(2,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=640
SET DIEZRXR(2,DIXR)=""
+2 QUIT
X20 SET %DT="E"
SET %DT(0)=-DT
DO ^%DT
KILL %DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
SET DFN=DA
DO SV^DGLOCK
IF $DATA(X)
if '$$VALMSE^DGRPMS(DFN,X,0,"MSL")
KILL X
IF $DATA(X)
SET DGFRDT=X
IF $DATA(^DG(43,1))
SET SD1=1
DO POS^DGINP
+1 QUIT
+2 ;
21 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=21
SET DW=".32;7"
SET DV="RDX"
SET DU=""
SET DIFLD=.327
SET DLB="L-RAD"
+1 SET DE(DW)="C21^DVBHCE"
SET DE(DW,"INDEX")=1
+2 GOTO RE
C21 if $DATA(DE(21))[0
GOTO C21S
KILL DB
+1 SET X=DE(21)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
+3 SET X=DE(21)
SET DIC=DIE
+4 if ($TEXT(ADGRU^DGRUDD01)'="")
DO ADGRU^DGRUDD01(DA)
C21S SET X=""
if DG(DQ)=X
GOTO C21F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
+3 SET X=DG(DQ)
SET DIC=DIE
+4 if ($TEXT(ADGRU^DGRUDD01)'="")
DO ADGRU^DGRUDD01(DA)
C21F1 SET DIEZRXR(2,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=303,640
SET DIEZRXR(2,DIXR)=""
+2 QUIT
X21 SET %DT="E"
SET %DT(0)=-DT
DO ^%DT
KILL %DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
SET DFN=DA
DO SV^DGLOCK
IF $DATA(X)
if '$$VALMSE^DGRPMS(DFN,X,1,"MSL")
KILL X
IF $DATA(X)
IF $DATA(^DG(43,1))
SET SD1=1
DO PS^DGINP
+1 QUIT
+2 ;
22 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=22
SET DW=".32;5"
SET DV="P23'X"
SET DU=""
SET DIFLD=.325
SET DLB="L-Bran.. Ser."
+1 SET DE(DW)="C22^DVBHCE"
SET DE(DW,"INDEX")=1
+2 SET DU="DIC(23,"
+3 GOTO RE
C22 if $DATA(DE(22))[0
GOTO C22S
KILL DB
+1 SET X=DE(22)
SET DIC=DIE
+2 SET A1B2TAG="PAT"
DO ^A1B2XFR
+3 SET X=DE(22)
SET DIC=DIE
+4 IF $PIECE($GET(^DPT(DA,.321)),U,14)]""
DO FVP^DGRPMS
+5 SET X=DE(22)
SET DIC=DIE
+6 DO EVENT^IVMPLOG(DA)
+7 SET X=DE(22)
SET DIC=DIE
+8 XECUTE "S DGXRF=.325 D ^DGDDC Q"
C22S SET X=""
if DG(DQ)=X
GOTO C22F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 SET A1B2TAG="PAT"
DO ^A1B2XFR
+3 SET X=DG(DQ)
SET DIC=DIE
+4 ;
+5 SET X=DG(DQ)
SET DIC=DIE
+6 DO EVENT^IVMPLOG(DA)
+7 SET X=DG(DQ)
SET DIC=DIE
+8 ;
C22F1 NEW X,X1,X2
SET DIXR=408
DO C22X1(U)
KILL X2
MERGE X2=X
DO C22X1("O")
KILL X1
MERGE X1=X
+1 Begin DoDot:1
+2 NEW DIEXARR
MERGE DIEXARR=X
SET DIEZCOND=1
+3 SET X=X2(1)=""
+4 SET DIEZCOND=$GET(X)
KILL X
MERGE X=DIEXARR
if 'DIEZCOND
QUIT
+5 DO DELMSE^DGRPMS(DA,1)
End DoDot:1
+6 GOTO C22F2
C22X1(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",2,DIIENS,.325,DION),$PIECE($GET(^DPT(DA,.32)),U,5))
+2 SET X=$GET(X(1))
+3 QUIT
C22F2 QUIT
X22 SET DFN=DA
if X=$ORDER(^DIC(23,"B","B.E.C.",""))
KILL X
IF $DATA(X)
DO SV^DGLOCK
SET DGCOMBR=$GET(Y)
QUIT
+1 QUIT
+2 ;
23 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=23
DO X23
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X23 IF X'=DVBJC
SET DVBJ2=1
+1 QUIT
24 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=24
SET DW=".32;4"
SET DV="RP25'X"
SET DU=""
SET DIFLD=.324
SET DLB="L-Char. Ser."
+1 SET DE(DW)="C24^DVBHCE"
+2 SET DU="DIC(25,"
+3 GOTO RE
C24 if $DATA(DE(24))[0
GOTO C24S
KILL DB
+1 SET X=DE(24)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C24S SET X=""
if DG(DQ)=X
GOTO C24F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C24F1 QUIT
X24 SET DFN=DA
IF $DATA(X)
DO SV^DGLOCK
QUIT
+1 QUIT
+2 ;
25 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=25
SET DW=".32;8"
SET DV="FX"
SET DU=""
SET DIFLD=.328
SET DLB="L-Ser. Num."
+1 SET DE(DW)="C25^DVBHCE"
+2 GOTO RE
C25 if $DATA(DE(25))[0
GOTO C25S
KILL DB
+1 SET X=DE(25)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C25S SET X=""
if DG(DQ)=X
GOTO C25F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C25F1 QUIT
X25 SET DFN=DA
DO SV^DGLOCK
IF $DATA(X)
if X?1"SS".E
SET L=$SELECT($DATA(^DPT(DA,0)):$PIECE(^(0),U,9),1:X)
if X?1"SS".E
WRITE " ",L
if X?1"SS".E
SET X=L
if $LENGTH(X)>15!($LENGTH(X)<1)!'(X?.N)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
26 ;@32
SET DQ=27
27 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=27
DO X27
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X27 IF Z2'[2
SET Y="@31"
+1 QUIT
28 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=28
DO X28
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X28 IF $ORDER(^DPT(D0,.3216,"B",0))
WRITE !!,*7,?17,DVBON,"Authoritative data, can't edit <RET>",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET Y="@33"
+1 QUIT
29 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=29
DO X29
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X29 IF '$DATA(^DPT(D0,.32))
WRITE !!,*7,?17,DVBON,"No Last episode can't edit NTLast <RET>",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET Y="@33"
+1 QUIT
30 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=30
DO X30
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X30 IF $PIECE(^DPT(D0,.32),U,6)=""
WRITE !!,*7,?17,DVBON,"No last episode can't edit NTLast <RET>",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET Y="@33"
+1 QUIT
31 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=31
DO X31
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X31 SET DVBSCR=1
DO ^DVBHS4
WRITE !,?34,DVBON,"[NTLAST]",DVBOFF
XECUTE DVBLIT1
+1 QUIT
32 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=32
SET DW=".32;19"
SET DV="RSX"
SET DU=""
SET DIFLD=.3285
SET DLB="Service NTL Episode"
+1 SET DE(DW)="C32^DVBHCE"
+2 SET DU="Y:YES;N:NO;"
+3 GOTO RE
C32 if $DATA(DE(32))[0
GOTO C32S
KILL DB
+1 SET X=DE(32)
SET DIC=DIE
+2 ;
+3 SET X=DE(32)
SET DIC=DIE
+4 ;
+5 SET X=DE(32)
SET DIC=DIE
+6 XECUTE ^DD(2,.3285,1,3,2.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DPT(D0,.32)):^(.32),1:"")
SET X=$PIECE(Y(1),U,10)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DPT(DIV(0),.32))
SET DIV=X
SET $PIECE(^(.32),U,10)=DIV
SET DIH=2
SET DIG=.3291
DO ^DICR
C32S SET X=""
if DG(DQ)=X
GOTO C32F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 XECUTE "I X'=""Y"" S DGXRF=.3285 D ^DGDDC Q"
+3 SET X=DG(DQ)
SET DIC=DIE
+4 XECUTE ^DD(2,.3285,1,2,1.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DPT(D0,.32)):^(.32),1:"")
SET X=$PIECE(Y(1),U,20)
SET X=X
SET DIU=X
KILL Y
SET X=DIV
SET X="N"
XECUTE ^DD(2,.3285,1,2,1.4)
+5 SET X=DG(DQ)
SET DIC=DIE
+6 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(0)=X
SET Y(1)=$CHAR(59)_$PIECE($GET(^DD(2,.3285,0)),U,3)
SET X=$PIECE($PIECE(Y(1),$CHAR(59)_Y(0)_":",2),$CHAR(59))'="YES"
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DPT(D0,.32)):^(.32),1:"")
SET X=$PIECE(Y(1),U,10)
SET X=X
SET DIU=X
KILL Y
SET X=""
XECUTE ^DD(2,.3285,1,3,1.4)
C32F1 QUIT
X32 SET DFN=DA
DO SV^DGLOCK
+1 QUIT
+2 ;
33 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=33
DO X33
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X33 IF $PIECE(^DPT(D0,.32),U,19)'="Y"
SET Y="@31"
+1 QUIT
34 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=34
SET DW=".32;11"
SET DV="RDX"
SET DU=""
SET DIFLD=.3292
SET DLB="NTL-EOD"
+1 SET DE(DW)="C34^DVBHCE"
SET DE(DW,"INDEX")=1
+2 GOTO RE
C34 if $DATA(DE(34))[0
GOTO C34S
KILL DB
+1 SET X=DE(34)
SET DIC=DIE
+2 ;
+3 SET X=DE(34)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
C34S SET X=""
if DG(DQ)=X
GOTO C34F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 ;
+3 SET X=DG(DQ)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
C34F1 SET DIEZRXR(2,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=641
SET DIEZRXR(2,DIXR)=""
+2 QUIT
X34 SET %DT="E"
SET %DT(0)=-DT
DO ^%DT
KILL %DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
SET DFN=DA
DO SER1^DGLOCK
IF $DATA(X)
if '$$VALMSE^DGRPMS(DFN,X,0,"MSNTL")
KILL X
IF $DATA(X)
SET DGFRDT=X
IF $DATA(^DG(43,1))
SET SD1=2
DO POS^DGINP
+1 QUIT
+2 ;
35 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=35
SET DW=".32;12"
SET DV="RDX"
SET DU=""
SET DIFLD=.3293
SET DLB="NTL-RAD"
+1 SET DE(DW)="C35^DVBHCE"
SET DE(DW,"INDEX")=1
+2 GOTO RE
C35 if $DATA(DE(35))[0
GOTO C35S
KILL DB
+1 SET X=DE(35)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C35S SET X=""
if DG(DQ)=X
GOTO C35F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C35F1 SET DIEZRXR(2,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=641
SET DIEZRXR(2,DIXR)=""
+2 QUIT
X35 SET %DT="E"
SET %DT(0)=-DT
DO ^%DT
KILL %DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
SET DFN=DA
DO SER1^DGLOCK
IF $DATA(X)
if '$$VALMSE^DGRPMS(DFN,X,1,"MSNTL")
KILL X
IF $DATA(X)
IF $DATA(^DG(43,1))
SET SD1=2
DO PS^DGINP
+1 QUIT
+2 ;
36 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=36
SET DW=".32;10"
SET DV="P23'X"
SET DU=""
SET DIFLD=.3291
SET DLB="NTL-Bran. Ser."
+1 SET DE(DW)="C36^DVBHCE"
SET DE(DW,"INDEX")=1
+2 SET DU="DIC(23,"
+3 GOTO RE
C36 if $DATA(DE(36))[0
GOTO C36S
KILL DB
+1 SET X=DE(36)
SET DIC=DIE
+2 IF $PIECE($GET(^DPT(DA,.321)),U,14)]""
DO FVP^DGRPMS
+3 SET X=DE(36)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
+5 SET X=DE(36)
SET DIC=DIE
+6 XECUTE "S DGXRF=.3291 D ^DGDDC Q"
C36S SET X=""
if DG(DQ)=X
GOTO C36F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 ;
+3 SET X=DG(DQ)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
+5 SET X=DG(DQ)
SET DIC=DIE
+6 ;
C36F1 NEW X,X1,X2
SET DIXR=409
DO C36X1(U)
KILL X2
MERGE X2=X
DO C36X1("O")
KILL X1
MERGE X1=X
+1 Begin DoDot:1
+2 NEW DIEXARR
MERGE DIEXARR=X
SET DIEZCOND=1
+3 SET X=X2(1)=""
+4 SET DIEZCOND=$GET(X)
KILL X
MERGE X=DIEXARR
if 'DIEZCOND
QUIT
+5 DO DELMSE^DGRPMS(DA,2)
End DoDot:1
+6 GOTO C36F2
C36X1(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",2,DIIENS,.3291,DION),$PIECE($GET(^DPT(DA,.32)),U,10))
+2 SET X=$GET(X(1))
+3 QUIT
C36F2 QUIT
X36 SET DFN=DA
if X=$ORDER(^DIC(23,"B","B.E.C.",""))
KILL X
IF $DATA(X)
DO SER1^DGLOCK
SET DGCOMBR=$GET(Y)
QUIT
+1 QUIT
+2 ;
37 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=37
SET DW=".32;9"
SET DV="RP25'X"
SET DU=""
SET DIFLD=.329
SET DLB="NTL-Char. Ser."
+1 SET DE(DW)="C37^DVBHCE"
+2 SET DU="DIC(25,"
+3 GOTO RE
C37 if $DATA(DE(37))[0
GOTO C37S
KILL DB
+1 SET X=DE(37)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C37S SET X=""
if DG(DQ)=X
GOTO C37F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C37F1 QUIT
X37 SET DFN=DA
DO SER1^DGLOCK
+1 QUIT
+2 ;
38 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=38
SET DW=".32;13"
SET DV="FX"
SET DU=""
SET DIFLD=.3294
SET DLB="NTL-Ser. Num."
+1 SET DE(DW)="C38^DVBHCE"
+2 GOTO RE
C38 if $DATA(DE(38))[0
GOTO C38S
KILL DB
+1 SET X=DE(38)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C38S SET X=""
if DG(DQ)=X
GOTO C38F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C38F1 QUIT
X38 SET DFN=DA
DO SER1^DGLOCK
IF $DATA(X)
if X?1"SS".E
SET L=$SELECT($DATA(^DPT(DA,0)):$PIECE(^(0),U,9),1:X)
if X?1"SS".E
WRITE " ",L
if X?1"SS".E
SET X=L
if $LENGTH(X)>15!($LENGTH(X)<1)!'(X?.N)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
39 ;@31
SET DQ=40
40 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=40
DO X40
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X40 IF Z2'[3
SET Y="@33"
+1 QUIT
41 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=41
DO X41
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X41 IF $ORDER(^DPT(D0,.3216,"B",0))
WRITE !!,*7,?17,DVBON,"Authoritative data, can't edit <RET>",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET Y="@33"
+1 QUIT
42 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=42
DO X42
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X42 IF '$DATA(^DPT(D0,.32))
WRITE !!,*7,?17,DVBON,"No NTLast episode can't edit NNTLast <RET>",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET Y="@33"
+1 QUIT
43 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=43
DO X43
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X43 IF $PIECE(^DPT(D0,.32),U,19)'="Y"
WRITE !!,*7,?17,DVBON,"No NTLast episode can't edit NNTLast <RET>.",DVBOFF
XECUTE DVBLIT1
READ DVBZ:DTIME
KILL DVBZ
SET Y="@33"
+1 QUIT
44 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=44
DO X44
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X44 SET DVBSCR=1
DO ^DVBHS4
WRITE !,?34,DVBON,"[NNTLAST]",DVBOFF
XECUTE DVBLIT1
+1 QUIT
45 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=45
SET DW=".32;20"
SET DV="RSX"
SET DU=""
SET DIFLD=.32945
SET DLB="Service NNTL Episode"
+1 SET DE(DW)="C45^DVBHCE"
+2 SET DU="Y:YES;N:NO;"
+3 GOTO RE
C45 if $DATA(DE(45))[0
GOTO C45S
KILL DB
+1 SET X=DE(45)
SET DIC=DIE
+2 ;
+3 SET X=DE(45)
SET DIC=DIE
+4 XECUTE ^DD(2,.32945,1,2,2.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DPT(D0,.32)):^(.32),1:"")
SET X=$PIECE(Y(1),U,15)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DPT(DIV(0),.32))
SET DIV=X
SET $PIECE(^(.32),U,15)=DIV
SET DIH=2
SET DIG=.3296
DO ^DICR
C45S SET X=""
if DG(DQ)=X
GOTO C45F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 XECUTE "I X'=""Y"" S DGXRF=.32945 D ^DGDDC Q"
+3 SET X=DG(DQ)
SET DIC=DIE
+4 XECUTE ^DD(2,.32945,1,2,1.3)
IF X
SET X=DIV
SET Y(1)=$SELECT($DATA(^DPT(D0,.32)):^(.32),1:"")
SET X=$PIECE(Y(1),U,15)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DPT(DIV(0),.32))
SET DIV=X
SET $PIECE(^(.32),U,15)=DIV
SET DIH=2
SET DIG=.3296
DO ^DICR
C45F1 QUIT
X45 SET DFN=DA
DO SV^DGLOCK
IF "N"'[$GET(X)
IF $DATA(^DPT(DFN,.32))
IF $PIECE(^(.32),U,19)'="Y"
WRITE !?4,*7,"Other Periods of service are not indicated...NO EDITING!"
KILL X
+1 QUIT
+2 ;
46 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=46
DO X46
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X46 IF $PIECE(^DPT(D0,.32),U,20)'="Y"
SET Y="@33"
+1 QUIT
47 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=47
SET DW=".32;16"
SET DV="RDX"
SET DU=""
SET DIFLD=.3297
SET DLB="NNTL-EOD"
+1 SET DE(DW)="C47^DVBHCE"
SET DE(DW,"INDEX")=1
+2 GOTO RE
C47 if $DATA(DE(47))[0
GOTO C47S
KILL DB
+1 SET X=DE(47)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C47S SET X=""
if DG(DQ)=X
GOTO C47F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C47F1 SET DIEZRXR(2,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=642
SET DIEZRXR(2,DIXR)=""
+2 QUIT
X47 SET %DT="E"
SET %DT(0)=-DT
DO ^%DT
KILL %DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
SET DFN=DA
DO SER2^DGLOCK
IF $DATA(X)
if '$$VALMSE^DGRPMS(DFN,X,0,"MSNNTL")
KILL X
IF $DATA(X)
SET DGFRDT=X
IF $DATA(^DG(43,1))
SET SD1=3
DO POS^DGINP
+1 QUIT
+2 ;
48 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=48
SET DW=".32;17"
SET DV="RDX"
SET DU=""
SET DIFLD=.3298
SET DLB="NNTL-RAD"
+1 SET DE(DW)="C48^DVBHCE"
SET DE(DW,"INDEX")=1
+2 GOTO RE
C48 if $DATA(DE(48))[0
GOTO C48S
KILL DB
+1 SET X=DE(48)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C48S SET X=""
if DG(DQ)=X
GOTO C48F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C48F1 SET DIEZRXR(2,DIIENS)=$$OREF^DILF($NAME(@$$CREF^DILF(DIE)))
+1 FOR DIXR=642
SET DIEZRXR(2,DIXR)=""
+2 QUIT
X48 SET %DT="E"
SET %DT(0)=-DT
DO ^%DT
KILL %DT
SET X=Y
if Y<1
KILL X
IF $DATA(X)
SET DFN=DA
DO SER2^DGLOCK
IF $DATA(X)
if '$$VALMSE^DGRPMS(DFN,X,1,"MSNNTL")
KILL X
IF $DATA(X)
IF $DATA(^DG(43,1))
SET SD1=3
DO PS^DGINP
+1 QUIT
+2 ;
49 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=49
SET DW=".32;15"
SET DV="P23'X"
SET DU=""
SET DIFLD=.3296
SET DLB="NNTL-Bran. Ser."
+1 SET DE(DW)="C49^DVBHCE"
SET DE(DW,"INDEX")=1
+2 SET DU="DIC(23,"
+3 GOTO RE
C49 if $DATA(DE(49))[0
GOTO C49S
KILL DB
+1 SET X=DE(49)
SET DIC=DIE
+2 IF $PIECE($GET(^DPT(DA,.321)),U,14)]""
DO FVP^DGRPMS
+3 SET X=DE(49)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
+5 SET X=DE(49)
SET DIC=DIE
+6 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DPT(D0,.3291)):^(.3291),1:"")
SET X=$PIECE(Y(1),U,3)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DPT(DIV(0),.3291))
SET DIV=X
SET $PIECE(^(.3291),U,3)=DIV
SET DIH=2
SET DIG=.32913
DO ^DICR
+7 SET X=DE(49)
SET DIC=DIE
+8 XECUTE "S DGXRF=.3296 D ^DGDDC Q"
C49S SET X=""
if DG(DQ)=X
GOTO C49F1
KILL DB
+1 SET X=DG(DQ)
SET DIC=DIE
+2 ;
+3 SET X=DG(DQ)
SET DIC=DIE
+4 DO EVENT^IVMPLOG(DA)
+5 SET X=DG(DQ)
SET DIC=DIE
+6 KILL DIV
SET DIV=X
SET D0=DA
SET DIV(0)=D0
SET Y(1)=$SELECT($DATA(^DPT(D0,.3291)):^(.3291),1:"")
SET X=$PIECE(Y(1),U,3)
SET X=X
SET DIU=X
KILL Y
SET X=""
SET DIH=$GET(^DPT(DIV(0),.3291))
SET DIV=X
SET $PIECE(^(.3291),U,3)=DIV
SET DIH=2
SET DIG=.32913
DO ^DICR
+7 SET X=DG(DQ)
SET DIC=DIE
+8 ;
C49F1 NEW X,X1,X2
SET DIXR=410
DO C49X1(U)
KILL X2
MERGE X2=X
DO C49X1("O")
KILL X1
MERGE X1=X
+1 Begin DoDot:1
+2 NEW DIEXARR
MERGE DIEXARR=X
SET DIEZCOND=1
+3 SET X=X2(1)=""
+4 SET DIEZCOND=$GET(X)
KILL X
MERGE X=DIEXARR
if 'DIEZCOND
QUIT
+5 DO DELMSE^DGRPMS(DA,3)
End DoDot:1
+6 GOTO C49F2
C49X1(DION) KILL X
+1 SET X(1)=$GET(@DIEZTMP@("V",2,DIIENS,.3296,DION),$PIECE($GET(^DPT(DA,.32)),U,15))
+2 SET X=$GET(X(1))
+3 QUIT
C49F2 QUIT
X49 SET DFN=DA
if X=$ORDER(^DIC(23,"B","B.E.C.",""))
KILL X
IF $DATA(X)
DO SER2^DGLOCK
SET DGCOMBR=$GET(Y)
QUIT
+1 QUIT
+2 ;
50 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=50
SET DW=".32;14"
SET DV="RP25'X"
SET DU=""
SET DIFLD=.3295
SET DLB="NNTL-Char. Ser."
+1 SET DE(DW)="C50^DVBHCE"
+2 SET DU="DIC(25,"
+3 GOTO RE
C50 if $DATA(DE(50))[0
GOTO C50S
KILL DB
+1 SET X=DE(50)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C50S SET X=""
if DG(DQ)=X
GOTO C50F1
KILL DB
+1 DO ^DVBHCE1
C50F1 QUIT
X50 SET DFN=DA
DO SER2^DGLOCK
+1 QUIT
+2 ;
51 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=51
SET DW=".32;18"
SET DV="FX"
SET DU=""
SET DIFLD=.3299
SET DLB="NNTL-Ser. Num."
+1 SET DE(DW)="C51^DVBHCE"
+2 GOTO RE
C51 if $DATA(DE(51))[0
GOTO C51S
KILL DB
+1 SET X=DE(51)
SET DIC=DIE
+2 DO EVENT^IVMPLOG(DA)
C51S SET X=""
if DG(DQ)=X
GOTO C51F1
KILL DB
+1 DO ^DVBHCE2
C51F1 QUIT
X51 SET DFN=DA
DO SER2^DGLOCK
IF $DATA(X)
if X?1"SS".E
SET L=$SELECT($DATA(^DPT(DA,0)):$PIECE(^(0),U,9),1:X)
if X?1"SS".E
WRITE " ",L
if X?1"SS".E
SET X=L
if $LENGTH(X)>15!($LENGTH(X)<1)!'(X?.N)
KILL X
+1 IF $DATA(X)
IF X'?.ANP
KILL X
+2 QUIT
+3 ;
52 ;@33
SET DQ=53
53 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=53
DO X53
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X53 IF Z2'[4
SET Y="@3"
+1 QUIT
54 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=54
DO X54
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X54 SET DVBSCR=1
DO ^DVBHS4
+1 QUIT
55 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=55
DO X55
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X55 SET DVBJC2=$SELECT($DATA(^DPT(D0,.32)):$PIECE(^(.32),U,3),1:"")
+1 QUIT
56 if $DATA(DG)>9
DO F^DIE17
DO DE
SET DQ=56
SET DW=".32;3"
SET DV="*P21'Xa"
SET DU=""
SET DIFLD=.323
SET DLB=$$LABEL^DIALOGZ(DP,DIFLD)
+1 SET DE(DW)="C56^DVBHCE"
+2 SET DU="DIC(21,"
+3 GOTO RE
C56 if $DATA(DE(56))[0
GOTO C56S
KILL DB
+1 DO ^DVBHCE3
C56S SET X=""
if DG(DQ)=X
GOTO C56F1
KILL DB
+1 DO ^DVBHCE4
C56F1 QUIT
X56 SET DFN=DA
DO POS^DGLOCK1
+1 QUIT
+2 ;
57 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=57
DO X57
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X57 IF X'=DVBJC2
SET DVBJ2=1
+1 QUIT
58 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=58
DO X58
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X58 KILL DVBJC2
+1 QUIT
59 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=59
DO X59
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X59 SET Y="@3"
+1 QUIT
60 ;@104
SET DQ=61
61 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=61
DO X61
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X61 DO ^DVBHS5
SET Y="@5"
KILL DXS
+1 QUIT
62 ;@204
SET DQ=63
63 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=63
DO X63
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X63 IF Z2'[1
SET Y="@205"
+1 QUIT
64 if $DATA(DG)>9
DO F^DIE17
DO DE
SET Y=U
SET DQ=64
DO X64
if $DATA(DIEFIRE)#2
DO FIREREC^DIE17
if $DATA(Y)[0
GOTO A
if Y=U
GOTO A
SET X=Y
SET DIC(0)="F"
SET DW=DQ
GOTO OUT^DIE17
X64 SET DVBSCR=1
DO ^DVBHS5
SET DVBJ2=1
+1 QUIT
65 if $DATA(DG)>9
DO F^DIE17
GOTO ^DVBHCE5