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

DVBHCE.m

Go to the documentation of this file.
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