INHPCO1 ; FRW ; 12 Nov 97 13:36; Manipulate GIS control files - cont.
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
;;
;
Q
;
ACTONE(INPROD) ;Fully activate an environment
;INPROD - production flag ( 1 - production ; 0 - development )
;
S INVERBOS=1
ACTIVVB ;activate in Verbose mode
S INPROD=+$G(INPROD)
D:'$G(DUZ) ENV^UTIL
;Activate non-production stuff
I 'INPROD D ACTIVTST
;Turn on all background processes
D BCKPROC(1)
;Activate all transaction types (Except MHCMIS?)
D TTALL(1)
;Reconnect replicated transaction types
D REP(1)
;Deactivate development stuff if production area
I INPROD D DEACTST
;Recompile all messages
D RECOMP
;Repopulate environmental control data
D REFRESH
;Update last active date
S $P(^INRHT("ALAST"),U,2)=$$NOW^%ZTFDT
K INVERBOS
Q
;
PREP ;Prep globals for packaging
;Verbose mode => 0 - verbose ; 1 - not verbose
S INVERBOS=1
PREPVB ;Verbose mode
D:'$G(DUZ) ENV^UTIL
;Gather environemental information
D REMEMBER
;Deactivate non-production stuff
D DEACTST
;Turn off all background processes
D BCKPROC(0)
;Clean up background process file
D BCKCLN
;Deactivate all trasnsaction types
D TTALL(0)
;Clean up destination file
D DEST(0)
;Disconnect REPlicated transaction types - delete Parent TT field
D REP(0)
;Recompile all messages
;D RECOMP ;The SCRIPT file is no longer sent out populated
;Re-index control files
D CONTROLS^INHPCO2
;Do miscellaneous
D MISC^INHPCO
K INVERBOS
;Update last prep date
S $P(^INRHT("ALAST"),U,1)=$$NOW^%ZTFDT
Q
;
RECOMP ;Recompile all messages
;
;Kill off script file
K ^INRHS S ^INRHS(0)="INTERFACE SCRIPT^4006"
;Delete SCRIPT field from all transaction types
K DR,DIE S DIE=4000,DA=0,DR=".03///@"
F C=0:1 S DA=$O(^INRHT(DA)) Q:'DA D ^DIE I '$G(INVERBOS) I '$G(INVERBOS) W !,"SCRIPT field deleted for Transaction Type: ",$P(^INRHT(DA,0),U)
;delete script fieldS from all messages
K DR,DIE S DIE=4011,DA=0,DR="100///@;101///@"
F C=0:1 S DA=$O(^INTHL7M(DA)) Q:'DA D ^DIE I '$G(INVERBOS) I '$G(INVERBOS) W !,"SCRIPT field(s) deleted for Script Generator Message: ",$P(^INTHL7M(DA,0),U)
;Recompile all messages
D ALLAUTO^INHSGZ
;
Q
;
TTALL(INST) ;Deactivate/Activate all transaction types
;
W:'$G(INVERBOS) !,"*** Processing Transaction Type file ***"
;Loop through all transaction types and take action
S INST=+$G(INST) N DIE,DR,INSTMSG
S INSTMSG=$S('INST:"DEACTIVATED",1:"ACTIVATED")
S DIE=4000,DR=".05///"_INST
;Loop through background process control file
S DA=0
F S DA=$O(^INRHT(DA)) Q:'DA D
. D ^DIE
. I '$G(INVERBOS) W !,"Transaction Type: ",$P(^INRHT(DA,0),U)," ",INSTMSG
Q
;
BPCONE(DA,INST) ;Activate/Deactivate one background process
;INPUT:
; DA - entry to process (ien)
; INST - what to do 0 - deactivate (def) ; 1 - activate
;
S INST=+$G(INST) N DIE,DR,INSTMSG
S INSTMSG=$S('INST:"DEACTIVATED",1:"ACTIVATED")
S DIE=4004,DR=".02///"_INST D ^DIE
W:'$G(INVERBOS) !,"Background Process: ",$P(^INTHPC(DA,0),U)," ",INSTMSG
Q
;
TTONE(DA,INST) ;Deactivate/activate one transaction type
;
S INST=+$G(INST) N DIE,DR,INSTMSG
;Do not activate MHCMIS I (DGM*) tt's
S INSTMSG=$P($G(^INRHT(DA,0)),U,1) Q:$E(INSTMSG,1,3)="DGM"&INST
S INSTMSG=$S('INST:"DEACTIVATED",1:"ACTIVATED")
S DIE=4000,DR=".05///"_INST D ^DIE
W:'$G(INVERBOS) !,"Transaction Type: ",$P(^INRHT(DA,0),U)," ",INSTMSG
Q
;
;Should script also be deleted when deactivating?
; - YES for non-production stuff
;Should PARENT be deactivated if it has no other active children
; - probably
;Should anything be done with the Message Replication File
;Should script be recompiled if activating
; - probably
;Should parent be activated if not already
; - probably
; - display warning if parent was inactive but had active children
;
MSGONE(DA,INST) ;Deactivate one message
;
S INST=+$G(INST) N DIE,DR,INSTMSG
;Do not activate MHCMIS I (DGM*) msgs
S INSTMSG=$P($G(^INTHL7M(DA,0)),U,1) Q:$E(INSTMSG,1,3)="DGM"&INST
S INSTMSG=$S('INST:"DEACTIVATED",1:"ACTIVATED")
;Set INACTIVE flag
S DIE=4011,DR=".08///"_$S('INST:1,1:0) D ^DIE
W:'$G(INVERBOS) !,"Script Generator Message: ",$P(^INTHL7M(DA,0),U)," ",INSTMSG
Q
;
;?? Should transaction types for messages also be deactivated
;?? Should scripts for message also be deactivated
;?? Should anything be done with the Message Replication File
Q
;
LOOP(INGL,INEXE,INGLDAT) ;Loop through a "B" x-ref
;INBGL - global to loop down
;INEXE - Executable code - DA will be the ien
;INGLDAT - global storage of file
;WON'T GET ANYTHNG THAT STARTS WITH inname
N INNAME,INLEN,INLOOP,DA
F INNAME="DGM","PROTO","TEST" D
. S INLEN=$L(INNAME),INLOOP=INNAME
. F S INLOOP=$O(@INGL@(INLOOP)) Q:$E(INLOOP,1,INLEN)'=INNAME D
.. S DA=0 F S DA=$O(@INGL@(INLOOP,DA)) Q:'DA D
... X INEXE
Q
;
BCKPROC(INST) ;Deactivate/Activate background processes
;
W:'$G(INVERBOS) !,"*** Processing Background Process Control File ***"
S INST=+$G(INST) N DIE,DR,INSTMSG
S INSTMSG=$S('INST:"DEACTIVATED",1:"ACTIVATED")
S DIE=4004,DR=".02///"_INST
;Loop through background process control file
S DA=2
F S DA=$O(^INTHPC(DA)) Q:'DA D
. D ^DIE
. I '$G(INVERBOS) W !,"Background Process: ",$P(^INTHPC(DA,0),U)," ",INSTMSG
Q
;
ACTSTONE(DA) ;Activate one non-production message
;
Q:$E($P(^INTHL7M(DA,0),U),1,3)="DGM"
N DR,DIE S DR=".08///0",DIE=4011
D ^DIE
I '$G(INVERBOS) W !,"Message: ",$P(^INTHL7M(DA,0),U)," ","ACTIVATED"
Q
;
DEST(INST) ;Destination file
;
S INST=+$G(INST) N DA,INSTMSG
S INSTMSG=$S('INST:"DEACTIVATED",1:"ACTIVATED")
I '$G(INVERBOS) W !,"*** Processing Destination file ***"
S DIE=4005,DR="7.02///@"
;Clean up ADDRESS ID and ROUTE ID field
I 'INST D
. S DA=0 F S DA=$O(^INRHD(DA)) Q:'DA K ^INRHD(DA,5),^(9) D ^DIE
. I '$G(INVERBOS) W !,"Destination file cleaned up"
;
Q
;
REP(INST) ;Disconnect/Connect replicated transactions
;
;;DO NOT ACTIVATE THIS MODULE WITHOUT DETAILED ANALYSIS OF IMPACTS
;
Q
;
I INST Q ;Currently not supporting replication
I '$G(INVERBOS) W !,"*** Processing Replicated Transaction Types ***"
S INST=+$G(INST) N DA,INSTMSG
S INSTMSG=$S('INST:"Parent deleted",1:"Parent = ")
N DA,DIE,DR S DA=2,DIE=4000,DR=".06///^S X=INEDIT"
S INEDIT="@"
F S DA=$O(^INRHT(DA)) Q:'DA D
. Q:$P(^INRHT(DA,0),U)'["(REP)"
. I INST D Q:'$L(INEDIT)
.. S INEDIT=$P($P(^INRHT(DA,0),U),"(REP)")_"(PARENT)"
.. I '$D(^INRHT("B",INEDIT)) W !,"Parent: ",INEDIT," not foud for Transaction Type: ",$P(^INRHT(DA,0),U) S INEDIT="" Q
. D ^DIE
. I '$G(INVERBOS) W !,$P(^INRHT(DA,0),U)," ",INSTMSG,INEDIT
Q
;
DEACTST ;Deactivate test stuff
D DEACTST^INHPCO Q
;
ACTIVTST ;Activate test stuff
D ACTIVTST^INHPCO Q
;
REMEMBER ;Remember environmental variables
D REMEMBER^INHPCO Q
;
REFRESH ;Refresh environmental variables
D REFRESH^INHPCO Q
;
BCKCLN ;Clean up background process control file
D BCKCLN^INHPCO Q
;
INHPCO1 ; FRW ; 12 Nov 97 13:36; Manipulate GIS control files - cont.
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
+3 ;;
+4 ;
+5 QUIT
+6 ;
ACTONE(INPROD) ;Fully activate an environment
+1 ;INPROD - production flag ( 1 - production ; 0 - development )
+2 ;
+3 SET INVERBOS=1
ACTIVVB ;activate in Verbose mode
+1 SET INPROD=+$GET(INPROD)
+2 IF '$GET(DUZ)
DO ENV^UTIL
+3 ;Activate non-production stuff
+4 IF 'INPROD
DO ACTIVTST
+5 ;Turn on all background processes
+6 DO BCKPROC(1)
+7 ;Activate all transaction types (Except MHCMIS?)
+8 DO TTALL(1)
+9 ;Reconnect replicated transaction types
+10 DO REP(1)
+11 ;Deactivate development stuff if production area
+12 IF INPROD
DO DEACTST
+13 ;Recompile all messages
+14 DO RECOMP
+15 ;Repopulate environmental control data
+16 DO REFRESH
+17 ;Update last active date
+18 SET $PIECE(^INRHT("ALAST"),U,2)=$$NOW^%ZTFDT
+19 KILL INVERBOS
+20 QUIT
+21 ;
PREP ;Prep globals for packaging
+1 ;Verbose mode => 0 - verbose ; 1 - not verbose
+2 SET INVERBOS=1
PREPVB ;Verbose mode
+1 IF '$GET(DUZ)
DO ENV^UTIL
+2 ;Gather environemental information
+3 DO REMEMBER
+4 ;Deactivate non-production stuff
+5 DO DEACTST
+6 ;Turn off all background processes
+7 DO BCKPROC(0)
+8 ;Clean up background process file
+9 DO BCKCLN
+10 ;Deactivate all trasnsaction types
+11 DO TTALL(0)
+12 ;Clean up destination file
+13 DO DEST(0)
+14 ;Disconnect REPlicated transaction types - delete Parent TT field
+15 DO REP(0)
+16 ;Recompile all messages
+17 ;D RECOMP ;The SCRIPT file is no longer sent out populated
+18 ;Re-index control files
+19 DO CONTROLS^INHPCO2
+20 ;Do miscellaneous
+21 DO MISC^INHPCO
+22 KILL INVERBOS
+23 ;Update last prep date
+24 SET $PIECE(^INRHT("ALAST"),U,1)=$$NOW^%ZTFDT
+25 QUIT
+26 ;
RECOMP ;Recompile all messages
+1 ;
+2 ;Kill off script file
+3 KILL ^INRHS
SET ^INRHS(0)="INTERFACE SCRIPT^4006"
+4 ;Delete SCRIPT field from all transaction types
+5 KILL DR,DIE
SET DIE=4000
SET DA=0
SET DR=".03///@"
+6 FOR C=0:1
SET DA=$ORDER(^INRHT(DA))
IF 'DA
QUIT
DO ^DIE
IF '$GET(INVERBOS)
IF '$GET(INVERBOS)
WRITE !,"SCRIPT field deleted for Transaction Type: ",$PIECE(^INRHT(DA,0),U)
+7 ;delete script fieldS from all messages
+8 KILL DR,DIE
SET DIE=4011
SET DA=0
SET DR="100///@;101///@"
+9 FOR C=0:1
SET DA=$ORDER(^INTHL7M(DA))
IF 'DA
QUIT
DO ^DIE
IF '$GET(INVERBOS)
IF '$GET(INVERBOS)
WRITE !,"SCRIPT field(s) deleted for Script Generator Message: ",$PIECE(^INTHL7M(DA,0),U)
+10 ;Recompile all messages
+11 DO ALLAUTO^INHSGZ
+12 ;
+13 QUIT
+14 ;
TTALL(INST) ;Deactivate/Activate all transaction types
+1 ;
+2 IF '$GET(INVERBOS)
WRITE !,"*** Processing Transaction Type file ***"
+3 ;Loop through all transaction types and take action
+4 SET INST=+$GET(INST)
NEW DIE,DR,INSTMSG
+5 SET INSTMSG=$SELECT('INST:"DEACTIVATED",1:"ACTIVATED")
+6 SET DIE=4000
SET DR=".05///"_INST
+7 ;Loop through background process control file
+8 SET DA=0
+9 FOR
SET DA=$ORDER(^INRHT(DA))
IF 'DA
QUIT
Begin DoDot:1
+10 DO ^DIE
+11 IF '$GET(INVERBOS)
WRITE !,"Transaction Type: ",$PIECE(^INRHT(DA,0),U)," ",INSTMSG
End DoDot:1
+12 QUIT
+13 ;
BPCONE(DA,INST) ;Activate/Deactivate one background process
+1 ;INPUT:
+2 ; DA - entry to process (ien)
+3 ; INST - what to do 0 - deactivate (def) ; 1 - activate
+4 ;
+5 SET INST=+$GET(INST)
NEW DIE,DR,INSTMSG
+6 SET INSTMSG=$SELECT('INST:"DEACTIVATED",1:"ACTIVATED")
+7 SET DIE=4004
SET DR=".02///"_INST
DO ^DIE
+8 IF '$GET(INVERBOS)
WRITE !,"Background Process: ",$PIECE(^INTHPC(DA,0),U)," ",INSTMSG
+9 QUIT
+10 ;
TTONE(DA,INST) ;Deactivate/activate one transaction type
+1 ;
+2 SET INST=+$GET(INST)
NEW DIE,DR,INSTMSG
+3 ;Do not activate MHCMIS I (DGM*) tt's
+4 SET INSTMSG=$PIECE($GET(^INRHT(DA,0)),U,1)
IF $EXTRACT(INSTMSG,1,3)="DGM"&INST
QUIT
+5 SET INSTMSG=$SELECT('INST:"DEACTIVATED",1:"ACTIVATED")
+6 SET DIE=4000
SET DR=".05///"_INST
DO ^DIE
+7 IF '$GET(INVERBOS)
WRITE !,"Transaction Type: ",$PIECE(^INRHT(DA,0),U)," ",INSTMSG
+8 QUIT
+9 ;
+10 ;Should script also be deleted when deactivating?
+11 ; - YES for non-production stuff
+12 ;Should PARENT be deactivated if it has no other active children
+13 ; - probably
+14 ;Should anything be done with the Message Replication File
+15 ;Should script be recompiled if activating
+16 ; - probably
+17 ;Should parent be activated if not already
+18 ; - probably
+19 ; - display warning if parent was inactive but had active children
+20 ;
MSGONE(DA,INST) ;Deactivate one message
+1 ;
+2 SET INST=+$GET(INST)
NEW DIE,DR,INSTMSG
+3 ;Do not activate MHCMIS I (DGM*) msgs
+4 SET INSTMSG=$PIECE($GET(^INTHL7M(DA,0)),U,1)
IF $EXTRACT(INSTMSG,1,3)="DGM"&INST
QUIT
+5 SET INSTMSG=$SELECT('INST:"DEACTIVATED",1:"ACTIVATED")
+6 ;Set INACTIVE flag
+7 SET DIE=4011
SET DR=".08///"_$SELECT('INST:1,1:0)
DO ^DIE
+8 IF '$GET(INVERBOS)
WRITE !,"Script Generator Message: ",$PIECE(^INTHL7M(DA,0),U)," ",INSTMSG
+9 QUIT
+10 ;
+11 ;?? Should transaction types for messages also be deactivated
+12 ;?? Should scripts for message also be deactivated
+13 ;?? Should anything be done with the Message Replication File
+14 QUIT
+15 ;
LOOP(INGL,INEXE,INGLDAT) ;Loop through a "B" x-ref
+1 ;INBGL - global to loop down
+2 ;INEXE - Executable code - DA will be the ien
+3 ;INGLDAT - global storage of file
+4 ;WON'T GET ANYTHNG THAT STARTS WITH inname
+5 NEW INNAME,INLEN,INLOOP,DA
+6 FOR INNAME="DGM","PROTO","TEST"
Begin DoDot:1
+7 SET INLEN=$LENGTH(INNAME)
SET INLOOP=INNAME
+8 FOR
SET INLOOP=$ORDER(@INGL@(INLOOP))
IF $EXTRACT(INLOOP,1,INLEN)'=INNAME
QUIT
Begin DoDot:2
+9 SET DA=0
FOR
SET DA=$ORDER(@INGL@(INLOOP,DA))
IF 'DA
QUIT
Begin DoDot:3
+10 XECUTE INEXE
End DoDot:3
End DoDot:2
End DoDot:1
+11 QUIT
+12 ;
BCKPROC(INST) ;Deactivate/Activate background processes
+1 ;
+2 IF '$GET(INVERBOS)
WRITE !,"*** Processing Background Process Control File ***"
+3 SET INST=+$GET(INST)
NEW DIE,DR,INSTMSG
+4 SET INSTMSG=$SELECT('INST:"DEACTIVATED",1:"ACTIVATED")
+5 SET DIE=4004
SET DR=".02///"_INST
+6 ;Loop through background process control file
+7 SET DA=2
+8 FOR
SET DA=$ORDER(^INTHPC(DA))
IF 'DA
QUIT
Begin DoDot:1
+9 DO ^DIE
+10 IF '$GET(INVERBOS)
WRITE !,"Background Process: ",$PIECE(^INTHPC(DA,0),U)," ",INSTMSG
End DoDot:1
+11 QUIT
+12 ;
ACTSTONE(DA) ;Activate one non-production message
+1 ;
+2 IF $EXTRACT($PIECE(^INTHL7M(DA,0),U),1,3)="DGM"
QUIT
+3 NEW DR,DIE
SET DR=".08///0"
SET DIE=4011
+4 DO ^DIE
+5 IF '$GET(INVERBOS)
WRITE !,"Message: ",$PIECE(^INTHL7M(DA,0),U)," ","ACTIVATED"
+6 QUIT
+7 ;
DEST(INST) ;Destination file
+1 ;
+2 SET INST=+$GET(INST)
NEW DA,INSTMSG
+3 SET INSTMSG=$SELECT('INST:"DEACTIVATED",1:"ACTIVATED")
+4 IF '$GET(INVERBOS)
WRITE !,"*** Processing Destination file ***"
+5 SET DIE=4005
SET DR="7.02///@"
+6 ;Clean up ADDRESS ID and ROUTE ID field
+7 IF 'INST
Begin DoDot:1
+8 SET DA=0
FOR
SET DA=$ORDER(^INRHD(DA))
IF 'DA
QUIT
KILL ^INRHD(DA,5),^(9)
DO ^DIE
+9 IF '$GET(INVERBOS)
WRITE !,"Destination file cleaned up"
End DoDot:1
+10 ;
+11 QUIT
+12 ;
REP(INST) ;Disconnect/Connect replicated transactions
+1 ;
+2 ;;DO NOT ACTIVATE THIS MODULE WITHOUT DETAILED ANALYSIS OF IMPACTS
+3 ;
+4 QUIT
+5 ;
+6 ;Currently not supporting replication
IF INST
QUIT
+7 IF '$GET(INVERBOS)
WRITE !,"*** Processing Replicated Transaction Types ***"
+8 SET INST=+$GET(INST)
NEW DA,INSTMSG
+9 SET INSTMSG=$SELECT('INST:"Parent deleted",1:"Parent = ")
+10 NEW DA,DIE,DR
SET DA=2
SET DIE=4000
SET DR=".06///^S X=INEDIT"
+11 SET INEDIT="@"
+12 FOR
SET DA=$ORDER(^INRHT(DA))
IF 'DA
QUIT
Begin DoDot:1
+13 IF $PIECE(^INRHT(DA,0),U)'["(REP)"
QUIT
+14 IF INST
Begin DoDot:2
+15 SET INEDIT=$PIECE($PIECE(^INRHT(DA,0),U),"(REP)")_"(PARENT)"
+16 IF '$DATA(^INRHT("B",INEDIT))
WRITE !,"Parent: ",INEDIT," not foud for Transaction Type: ",$PIECE(^INRHT(DA,0),U)
SET INEDIT=""
QUIT
End DoDot:2
IF '$LENGTH(INEDIT)
QUIT
+17 DO ^DIE
+18 IF '$GET(INVERBOS)
WRITE !,$PIECE(^INRHT(DA,0),U)," ",INSTMSG,INEDIT
End DoDot:1
+19 QUIT
+20 ;
DEACTST ;Deactivate test stuff
+1 DO DEACTST^INHPCO
QUIT
+2 ;
ACTIVTST ;Activate test stuff
+1 DO ACTIVTST^INHPCO
QUIT
+2 ;
REMEMBER ;Remember environmental variables
+1 DO REMEMBER^INHPCO
QUIT
+2 ;
REFRESH ;Refresh environmental variables
+1 DO REFRESH^INHPCO
QUIT
+2 ;
BCKCLN ;Clean up background process control file
+1 DO BCKCLN^INHPCO
QUIT
+2 ;