MAGJINI ;;WIRMFO/JHC VistaRad Maintenance functions [ 07/07/1999 2:42 PM ]
;;3.0;IMAGING;;Mar 01, 2002
;990707--created routine
; Subroutines for VistaRad KIDS inits
;
ENV ; "Environment Check" for KIDS Install
Q
KOLDDD ; K ^DD(2006.631,3),^(4),^DD(2006.631,"B","SEARCH"),^DD(2006.631,"B","SEARCH2")
; K ^DD(2006.631,"GL",3),^(4),^DD(2006.631,"SB",2006.6313,3),^DD(2006.631,"SB",2006.6314,4)
Q
MAG30T5A ; EP for KIDS PRE-Install init magj 3.0t5
D PREFKIL
Q
MAG30T5B ; EP for KIDS POST-Install init magj 3.0t5
D B2006631,D2006631
Q
MAG30T7A ; EP for KIDS PRE-Install init magj 3.0t7
D BGCSTOP
Q
MAG30T7B ; EP for KIDS POST-Install init magj 3.0t7
D BGCSTRT
Q
;
MAG30T8A ; EP for KIDS Pre-Install init magj 3.0t8
;D BGCSTOP
Q
MAG30T8B ; EP for KIDS POST-Install init magj 3.0t8
D B2006631,BGCSTRT
Q
;
MG30T11A ; EP for KIDS Pre-Install init magj 3.0t11
D BGCSTOP
Q
MG30T11B ; EP for KIDS POST-Install init magj 3.0t11
D BUILD72,B2006631,BGCSTRT
Q
;
MG30T18A ; EP for KIDS Pre-Install init magj 3.0t18
D INIT63
Q
MG30T18B ; EP for KIDS POST-Install init magj 3.0t18
D B2006631
Q
;
BUILD72 ; copy Exam Status Category data to RAD file #72
N IEN,CAT,RAIEN S IEN=0
I $D(^MAG(2006.69,"FILE72")) Q ; already did this
F S IEN=$O(^MAG(2006.61,IEN)) Q:'IEN S X=$G(^(IEN,0)) D
. I X S RAIEN=+X,CAT=$P(X,U,2) I CAT]"",("DETW"[CAT) D
. . I '$D(^RA(72,RAIEN)) Q ; should never occur, but . . .
. . S DIE=72,DA=RAIEN,DR="9////"_CAT D ^DIE
. . K DIE,DA,DR,DIC
S ^MAG(2006.69,"FILE72")=$H
Q
;
BGCSTOP ; Stop Background Compile program
S MAGCSTRT=0,GO=1 K RETRY
K ^MAG(2006.69,"KIDS")
S X=$G(^MAG(2006.69,1,0))
I X]"",$P(X,U,8) D
. S ^MAG(2006.69,"KIDS")=X ; save current settings for restore later
. S MAGCSTRT=1
. S $P(X,U,8)=0
. S ^MAG(2006.69,1,0)=X ; disable compile
. W !!,*7,"Wait for Background Compile program to stop;"
. W !," this might take up to a few minutes."
. S NTRY=100
. F I=1:1:NTRY L +^XTMP("MAGJ2","BKGND2","RUN"):3 I Q
. W !!,"Background Compile "
. I W "Stopped; proceed with install." L -^XTMP("MAGJ2","BKGND2","RUN")
. E W "NOT Stopped -- Try again? Y// " D
. . R X:120 S X=$TR($E(X),"ynYN","YNYN") S RETRY="Y"[X,GO=0
. . S ^MAG(2006.69,1,0)=^MAG(2006.69,"KIDS") K ^MAG(2006.69,"KIDS")
I 'GO G BGCSTOP:RETRY W !!,"Exiting out of Install" S XPDQUIT=1
Q
BGCSTRT ; re-enable Background Compile
I '$D(^MAG(2006.69,"KIDS")) Q ; had not been enabled
S ^MAG(2006.69,1,0)=^MAG(2006.69,"KIDS") K ^MAG(2006.69,"KIDS")
W !!,"Background Compile Enabled again"
Q
;
PREFKIL ; initialize the Prior Exams Logic File (Prefetch logic)
I $D(^MAG(2006.65,0)) S X=^(0) D
. S $P(X,U,3,4)="0^0"
. K ^MAG(2006.65) S ^MAG(2006.65,0)=X
Q
;
D2006631 ; Clean Up old vs List Definition file
K DIU S DIU=2006.6313 S DIU(0)="DS" D EN^DIU2
K DIU S DIU=2006.6314 S DIU(0)="DS" D EN^DIU2
K DIU
Q
;
INIT63 ; Initialize 2006.63 for re-create updated version
; This must always be followed by running B2006631
K ^MAG(2006.63)
Q
;
B2006631 ; Create "DEF" nodes, Button labels for updated List Def'ns
N SS,LSTDAT,LSTNUM,BUTTON,LSTTYP
S SS=0
F S SS=$O(^MAG(2006.631,SS)) Q:'SS S LSTDAT=$G(^(SS,0)) I LSTDAT]"" D
. S LSTNUM=$P(LSTDAT,U,2),BUTTON=$P(LSTDAT,U,7),LSTTYP=$P(LSTDAT,U,3)
. I LSTNUM>9900!$P(LSTDAT,U,6) D BLDDEF^MAGJMN1(SS) ; build DEF nodes for System Lists & any Enabled lists
. I BUTTON="",(LSTTYP]"") D ; Create Button Labels
. . S BUTTON=$S(LSTTYP="U":"Unread #",LSTTYP="R":"Recent #",LSTTYP="A":"All Active #",LSTTYP="P":"Pending #",1:"List #")_LSTNUM
. . S $P(^MAG(2006.631,SS,0),U,7)=BUTTON
Q
END ;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGJINI 3711 printed Oct 16, 2024@18:07:25 Page 2
MAGJINI ;;WIRMFO/JHC VistaRad Maintenance functions [ 07/07/1999 2:42 PM ]
+1 ;;3.0;IMAGING;;Mar 01, 2002
+2 ;990707--created routine
+3 ; Subroutines for VistaRad KIDS inits
+4 ;
ENV ; "Environment Check" for KIDS Install
+1 QUIT
KOLDDD ; K ^DD(2006.631,3),^(4),^DD(2006.631,"B","SEARCH"),^DD(2006.631,"B","SEARCH2")
+1 ; K ^DD(2006.631,"GL",3),^(4),^DD(2006.631,"SB",2006.6313,3),^DD(2006.631,"SB",2006.6314,4)
+2 QUIT
MAG30T5A ; EP for KIDS PRE-Install init magj 3.0t5
+1 DO PREFKIL
+2 QUIT
MAG30T5B ; EP for KIDS POST-Install init magj 3.0t5
+1 DO B2006631
DO D2006631
+2 QUIT
MAG30T7A ; EP for KIDS PRE-Install init magj 3.0t7
+1 DO BGCSTOP
+2 QUIT
MAG30T7B ; EP for KIDS POST-Install init magj 3.0t7
+1 DO BGCSTRT
+2 QUIT
+3 ;
MAG30T8A ; EP for KIDS Pre-Install init magj 3.0t8
+1 ;D BGCSTOP
+2 QUIT
MAG30T8B ; EP for KIDS POST-Install init magj 3.0t8
+1 DO B2006631
DO BGCSTRT
+2 QUIT
+3 ;
MG30T11A ; EP for KIDS Pre-Install init magj 3.0t11
+1 DO BGCSTOP
+2 QUIT
MG30T11B ; EP for KIDS POST-Install init magj 3.0t11
+1 DO BUILD72
DO B2006631
DO BGCSTRT
+2 QUIT
+3 ;
MG30T18A ; EP for KIDS Pre-Install init magj 3.0t18
+1 DO INIT63
+2 QUIT
MG30T18B ; EP for KIDS POST-Install init magj 3.0t18
+1 DO B2006631
+2 QUIT
+3 ;
BUILD72 ; copy Exam Status Category data to RAD file #72
+1 NEW IEN,CAT,RAIEN
SET IEN=0
+2 ; already did this
IF $DATA(^MAG(2006.69,"FILE72"))
QUIT
+3 FOR
SET IEN=$ORDER(^MAG(2006.61,IEN))
if 'IEN
QUIT
SET X=$GET(^(IEN,0))
Begin DoDot:1
+4 IF X
SET RAIEN=+X
SET CAT=$PIECE(X,U,2)
IF CAT]""
IF ("DETW"[CAT)
Begin DoDot:2
+5 ; should never occur, but . . .
IF '$DATA(^RA(72,RAIEN))
QUIT
+6 SET DIE=72
SET DA=RAIEN
SET DR="9////"_CAT
DO ^DIE
+7 KILL DIE,DA,DR,DIC
End DoDot:2
End DoDot:1
+8 SET ^MAG(2006.69,"FILE72")=$HOROLOG
+9 QUIT
+10 ;
BGCSTOP ; Stop Background Compile program
+1 SET MAGCSTRT=0
SET GO=1
KILL RETRY
+2 KILL ^MAG(2006.69,"KIDS")
+3 SET X=$GET(^MAG(2006.69,1,0))
+4 IF X]""
IF $PIECE(X,U,8)
Begin DoDot:1
+5 ; save current settings for restore later
SET ^MAG(2006.69,"KIDS")=X
+6 SET MAGCSTRT=1
+7 SET $PIECE(X,U,8)=0
+8 ; disable compile
SET ^MAG(2006.69,1,0)=X
+9 WRITE !!,*7,"Wait for Background Compile program to stop;"
+10 WRITE !," this might take up to a few minutes."
+11 SET NTRY=100
+12 FOR I=1:1:NTRY
LOCK +^XTMP("MAGJ2","BKGND2","RUN"):3
IF $TEST
QUIT
+13 WRITE !!,"Background Compile "
+14 IF $TEST
WRITE "Stopped; proceed with install."
LOCK -^XTMP("MAGJ2","BKGND2","RUN")
+15 IF '$TEST
WRITE "NOT Stopped -- Try again? Y// "
Begin DoDot:2
+16 READ X:120
SET X=$TRANSLATE($EXTRACT(X),"ynYN","YNYN")
SET RETRY="Y"[X
SET GO=0
+17 SET ^MAG(2006.69,1,0)=^MAG(2006.69,"KIDS")
KILL ^MAG(2006.69,"KIDS")
End DoDot:2
End DoDot:1
+18 IF 'GO
if RETRY
GOTO BGCSTOP
WRITE !!,"Exiting out of Install"
SET XPDQUIT=1
+19 QUIT
BGCSTRT ; re-enable Background Compile
+1 ; had not been enabled
IF '$DATA(^MAG(2006.69,"KIDS"))
QUIT
+2 SET ^MAG(2006.69,1,0)=^MAG(2006.69,"KIDS")
KILL ^MAG(2006.69,"KIDS")
+3 WRITE !!,"Background Compile Enabled again"
+4 QUIT
+5 ;
PREFKIL ; initialize the Prior Exams Logic File (Prefetch logic)
+1 IF $DATA(^MAG(2006.65,0))
SET X=^(0)
Begin DoDot:1
+2 SET $PIECE(X,U,3,4)="0^0"
+3 KILL ^MAG(2006.65)
SET ^MAG(2006.65,0)=X
End DoDot:1
+4 QUIT
+5 ;
D2006631 ; Clean Up old vs List Definition file
+1 KILL DIU
SET DIU=2006.6313
SET DIU(0)="DS"
DO EN^DIU2
+2 KILL DIU
SET DIU=2006.6314
SET DIU(0)="DS"
DO EN^DIU2
+3 KILL DIU
+4 QUIT
+5 ;
INIT63 ; Initialize 2006.63 for re-create updated version
+1 ; This must always be followed by running B2006631
+2 KILL ^MAG(2006.63)
+3 QUIT
+4 ;
B2006631 ; Create "DEF" nodes, Button labels for updated List Def'ns
+1 NEW SS,LSTDAT,LSTNUM,BUTTON,LSTTYP
+2 SET SS=0
+3 FOR
SET SS=$ORDER(^MAG(2006.631,SS))
if 'SS
QUIT
SET LSTDAT=$GET(^(SS,0))
IF LSTDAT]""
Begin DoDot:1
+4 SET LSTNUM=$PIECE(LSTDAT,U,2)
SET BUTTON=$PIECE(LSTDAT,U,7)
SET LSTTYP=$PIECE(LSTDAT,U,3)
+5 ; build DEF nodes for System Lists & any Enabled lists
IF LSTNUM>9900!$PIECE(LSTDAT,U,6)
DO BLDDEF^MAGJMN1(SS)
+6 ; Create Button Labels
IF BUTTON=""
IF (LSTTYP]"")
Begin DoDot:2
+7 SET BUTTON=$SELECT(LSTTYP="U":"Unread #",LSTTYP="R":"Recent #",LSTTYP="A":"All Active #",LSTTYP="P":"Pending #",1:"List #")_LSTNUM
+8 SET $PIECE(^MAG(2006.631,SS,0),U,7)=BUTTON
End DoDot:2
End DoDot:1
+9 QUIT
END ;