INTENV ; bar ; 19 Jun 96 15:57; Menu driver for GIS environment mgmt system
;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
;COPYRIGHT 1991-2000 SAIC
EN ;Main entry point
D ENV^UTIL
Q:'$G(DUZ)
INITO ;Build option list
K OPT
F OCO=1:1 S OPT=$P($T(OPT+OCO),";;",2) Q:OPT="" S OPT(OCO)=OPT
PAINT ;Paint screen
W #,!!?15,"GIS Development Environment Management",!
S OCO=0
F COUNT=0:1 S OCO=$O(OPT(OCO)) Q:'OCO D
. W !,?10,OCO,".",?15,$P(OPT(OCO),U),?50 W $S($L($P(OPT(OCO),U,2)):"("_$P(OPT(OCO),U,2,3)_")",1:"*INACTIVE*")
W !!,?20,"Select Option NUMBER (1-",COUNT,"): "
R SEL:$G(DTIME,300)
VAL ;Validate option
I SEL=""!($E(SEL)=U) Q
I '$D(OPT(SEL)) W *7 G PAINT
EX ;Execute option
W #,!!,?(80-$L($P(OPT(SEL),U))-8\2),"*** ",$P(OPT(SEL),U,1)," ***",!!
I '$L($P(OPT(SEL),U,2)) W *7 G INITO
D @($P(OPT(SEL),U,2,3))
W ! S X=$$CR^INHU1
G INITO
Q
;
OPT ;List of options <- max name length
;;General daily clean up (Green)^GREEN^INTENV
;;Major clean up/MFN purge (Yellow)^YELLOW^INTENV
;;Clear all GIS dynamic files (Red)^RED^INTENV
;;Purge transactions by type^PTT^INTENV
;;Purge transactions by destination^PDT^INTENV
;;Purge and/or consolidate errors^PERR^INTENV
;;
PTT ; purge trans by TT
L +^INRHB("PURGE"):1 E W !!,"Purge already running.",! Q
L -^INRHB("PURGE")
N INPURGE,INTT
S INPURGE=$$DATA Q:'$L(INPURGE)
Q:$$TTYPE(.INTT) Q:'$$SURE(2)
D TASK("PTTT^INTENV","Purge GIS by type","INPURGE,INTT(")
Q
PTTT ;
L +^INRHB("PURGE"):5 E Q
D TPURGE^INTENV1(INPURGE,.INTT)
L -^INRHB("PURGE")
Q
;
PDT ; purge trans by dest
L +^INRHB("PURGE"):1 E W !!,"Purge already running.",! Q
L -^INRHB("PURGE")
N INPURGE,INDEST
S INPURGE=$$DATA Q:'$L(INPURGE)
S INDEST=$$DEST Q:'INDEST
Q:'$$SURE(2)
D TASK("PDTT^INTENV","Purge GIS by dest","INPURGE,INDEST")
Q
PDTT ;
L +^INRHB("PURGE"):5 E Q
D TDPURGE^INTENV1(INPURGE,INDEST)
L -^INRHB("PURGE")
Q
;
PERR ; purge errors
L +^INRHB("PURGE"):1 E W !!,"Purge already running.",! Q
L -^INRHB("PURGE")
N INPURGE,INCON
S INPURGE=$$DATA Q:'$L(INPURGE)
S INCON=$$YN^UTSRD("Do you want to consolidate the remaining errors? ;0","^D ECONH^INTENV")
Q:INCON["^"
Q:'$$SURE(2)
D TASK("PERRT^INTENV","Purge GIS Errors","INPURGE,INCON")
Q
;
PERRT ;
L +^INRHB("PURGE"):5 E Q
D EPURGE^INTENV1(INPURGE,INCON)
L -^INRHB("PURGE")
Q
;
GREEN ; general daily clean up - GREEN purge
L +^INRHB("PURGE"):1 E W !!,"Purge already running.",! Q
L -^INRHB("PURGE")
S INPURGE=$$SITE
W !!,"This option will purge GIS transactions and errors."
W !,"It will keep "_(INPURGE*24)_" hours worth of transactions and errors."
W !,"All broken entries in the destination queue will be removed.",!
Q:'$$SURE(1)
S INPURGE=INPURGE_"D"
D TASK("YELLOWT^INTENV","Purge GIS Trans & Err","INPURGE")
Q
;
GREENT ;
L +^INRHB("PURGE"):5 E Q
D TPURGE^INTENV1(INPURGE),EPURGE^INTENV1(INPURGE),DPURGE^INTENV1
L -^INRHB("PURGE")
Q
;
YELLOW ; purge all by time
L +^INRHB("PURGE"):1 E W !!,"Purge already running.",! Q
L -^INRHB("PURGE")
W !!,"This option will purge GIS transactions and errors."
W !,"It will keep 72 hours worth of transactions, purge all MFN's,"
W !,"keep 24 hours of errors and consolidate remaining errors.",!
W !,"All broken entries in the destination queue will be removed.",!
Q:'$$SURE(2)
D TASK("YELLOWT^INTENV","Purge GIS Trans & Err")
Q
;
YELLOWT ;
L +^INRHB("PURGE"):5 E Q
D TPURGE^INTENV1("3D"),TPURGE^INTENV1("0D","*MASTER FILE*"),EPURGE^INTENV1("1D",1),DPURGE^INTENV1
L -^INRHB("PURGE")
Q
;
RED ; stop GIS and clean out all dynamic globals
W !!,"This will STOP all processes of the GIS and COMPLETELY"
W !,"DELETE all transactions, errors, and CLEAR all queues.",!
Q:'$$SURE(3)
W !!,"Shutting down GIS..."
D SHUT^INTENV1
W "done.",!!,"Clearing all transactions, errors, and queues..."
D CLEAN^INTENV1
W "done.",!
Q
;
DATA() ; ask for amount of data
N INX,INOUT S INOUT=0
F R !,"Enter amount of data to keep: ",INX:$G(DTIME,300) D Q:INOUT
. I '$L(INX)!(INX["^") S INOUT=1,INX="" Q
. I $E("NONE",1,$L(INX))=INX S INX="0D",INOUT=1 Q
. I INX?1.N1U,"DHM"[$E(INX,$L(INX)) S INOUT=1 Q
. W:INX'["?" *7," ??"
. W !," Enter a code for the length of time to keep data."
. W !," format: nL where n = number and L is a letter"
. W !," D = days, H = hours, M = minute"
. W !," You may also enter NONE to not keep any data.",!
Q INX
;
TTYPE(INTTA) ; get transaction types to delete
; output: INTTA = array of TTs
;
N C,INTT,INOUT
F R !,"Enter Transaction Type(s) to delete: ",INTT:$G(DTIME,300) D Q:$D(INOUT)
. I INTT="^L" D TTLIST(.INTTA) Q
. I '$L(INTT) S INOUT=0,INTT="" Q
. I INTT["^" S INOUT=1,INTT="" Q
. I INTT["?" D Q
.. W !," Transactions can be deleted based on the Tranasaction"
.. W !," Types entered here. You can use wild cards ""*"" to select"
.. W !," many types. If you enter nothing, all transactions"
.. W !," within the purge date range will be deleted."
.. W !," Enter ""^L"" to see what is selected so far."
.. W !," Enter ""^"" to exit."
. S C=$$TTCONV^INTENV1(INTT,.INTTA)
. W " "_$TR(C,"-")_" "_$S($E(INTT)="-":"de",1:"")_"selected"
S:$D(INTTA)<10 INOUT=1
Q INOUT
;
TTLIST(INTTA) ; list out selected TT
; input: INTTA = array of Tranaaction Types
N I,Y,L,%
S I=0,L=$G(IOSL,24)-4,%=""
F Y=1:1 S I=$O(INTTA(I)) Q:'I S:Y>L Y=0,%=$$CR^UTSRD Q:% W !,INTTA(I)
Q
;
DEST() ; select destination
N DIC,Y
S DIC="^INRHD(",DIC(0)="AEMQZ",DIC("S")="I $D(^INLHDEST(Y))"
D ^DIC S:Y<0 Y=0
Q +Y
;
SURE(INREP) ; are you sure question
; input: INREP = number of times to ask, max is three for now
N I,P,X
F I=1:1:INREP D W ! S X=$$YN^UTSRD(" "_P_$C(7)_" ;0") Q:'X
. S P=$S(I=1:"Is this ok?",I=2:"Are you sure?",1:"This is going to delete a lot of data. Are you really sure?")
W ! Q X
;
ECONH ; help for consolidate question
W !," If YES, the error log will retain the most recent of each type of"
W !," error and delete the duplicates after the purge date."
W !," IF NO, only errors before the purge date will be deleted."
Q
;
TASK(ZTRTN,ZTDESC,INSAVE) ; send routine to background
; input: ZTRTN = routine to run
; ZTDESC = Description of task
N X,I
S X=$$YN^UTSRD("Do you want to run this in the background? ;1")
I X K ZTDTH S ZTIO="NL:" D D ^%ZTLOAD W !,"Queued to background. ("_$G(ZTSK)_")" Q
. F I=1:1 S X=$P($G(INSAVE),",",I) Q:'$L(X) S ZTSAVE(X)=""
D @ZTRTN
Q
;
SITE() ; return # of days from GIS site parms
N X
S X=$P($G(^INRHSITE(1,0)),U,11) S:'X X=3
Q X
;
INTENV ; bar ; 19 Jun 96 15:57; Menu driver for GIS environment mgmt system
+1 ;;3.01;BHL IHS Interfaces with GIS;;JUL 01, 2001
+2 ;COPYRIGHT 1991-2000 SAIC
EN ;Main entry point
+1 DO ENV^UTIL
+2 IF '$GET(DUZ)
QUIT
INITO ;Build option list
+1 KILL OPT
+2 FOR OCO=1:1
SET OPT=$PIECE($TEXT(OPT+OCO),";;",2)
IF OPT=""
QUIT
SET OPT(OCO)=OPT
PAINT ;Paint screen
+1 WRITE #,!!?15,"GIS Development Environment Management",!
+2 SET OCO=0
+3 FOR COUNT=0:1
SET OCO=$ORDER(OPT(OCO))
IF 'OCO
QUIT
Begin DoDot:1
+4 WRITE !,?10,OCO,".",?15,$PIECE(OPT(OCO),U),?50
WRITE $SELECT($LENGTH($PIECE(OPT(OCO),U,2)):"("_$PIECE(OPT(OCO),U,2,3)_")",1:"*INACTIVE*")
End DoDot:1
+5 WRITE !!,?20,"Select Option NUMBER (1-",COUNT,"): "
+6 READ SEL:$GET(DTIME,300)
VAL ;Validate option
+1 IF SEL=""!($EXTRACT(SEL)=U)
QUIT
+2 IF '$DATA(OPT(SEL))
WRITE *7
GOTO PAINT
EX ;Execute option
+1 WRITE #,!!,?(80-$LENGTH($PIECE(OPT(SEL),U))-8\2),"*** ",$PIECE(OPT(SEL),U,1)," ***",!!
+2 IF '$LENGTH($PIECE(OPT(SEL),U,2))
WRITE *7
GOTO INITO
+3 DO @($PIECE(OPT(SEL),U,2,3))
+4 WRITE !
SET X=$$CR^INHU1
+5 GOTO INITO
+6 QUIT
+7 ;
OPT ;List of options <- max name length
+1 ;;General daily clean up (Green)^GREEN^INTENV
+2 ;;Major clean up/MFN purge (Yellow)^YELLOW^INTENV
+3 ;;Clear all GIS dynamic files (Red)^RED^INTENV
+4 ;;Purge transactions by type^PTT^INTENV
+5 ;;Purge transactions by destination^PDT^INTENV
+6 ;;Purge and/or consolidate errors^PERR^INTENV
+7 ;;
PTT ; purge trans by TT
+1 LOCK +^INRHB("PURGE"):1
IF '$TEST
WRITE !!,"Purge already running.",!
QUIT
+2 LOCK -^INRHB("PURGE")
+3 NEW INPURGE,INTT
+4 SET INPURGE=$$DATA
IF '$LENGTH(INPURGE)
QUIT
+5 IF $$TTYPE(.INTT)
QUIT
IF '$$SURE(2)
QUIT
+6 DO TASK("PTTT^INTENV","Purge GIS by type","INPURGE,INTT(")
+7 QUIT
PTTT ;
+1 LOCK +^INRHB("PURGE"):5
IF '$TEST
QUIT
+2 DO TPURGE^INTENV1(INPURGE,.INTT)
+3 LOCK -^INRHB("PURGE")
+4 QUIT
+5 ;
PDT ; purge trans by dest
+1 LOCK +^INRHB("PURGE"):1
IF '$TEST
WRITE !!,"Purge already running.",!
QUIT
+2 LOCK -^INRHB("PURGE")
+3 NEW INPURGE,INDEST
+4 SET INPURGE=$$DATA
IF '$LENGTH(INPURGE)
QUIT
+5 SET INDEST=$$DEST
IF 'INDEST
QUIT
+6 IF '$$SURE(2)
QUIT
+7 DO TASK("PDTT^INTENV","Purge GIS by dest","INPURGE,INDEST")
+8 QUIT
PDTT ;
+1 LOCK +^INRHB("PURGE"):5
IF '$TEST
QUIT
+2 DO TDPURGE^INTENV1(INPURGE,INDEST)
+3 LOCK -^INRHB("PURGE")
+4 QUIT
+5 ;
PERR ; purge errors
+1 LOCK +^INRHB("PURGE"):1
IF '$TEST
WRITE !!,"Purge already running.",!
QUIT
+2 LOCK -^INRHB("PURGE")
+3 NEW INPURGE,INCON
+4 SET INPURGE=$$DATA
IF '$LENGTH(INPURGE)
QUIT
+5 SET INCON=$$YN^UTSRD("Do you want to consolidate the remaining errors? ;0","^D ECONH^INTENV")
+6 IF INCON["^"
QUIT
+7 IF '$$SURE(2)
QUIT
+8 DO TASK("PERRT^INTENV","Purge GIS Errors","INPURGE,INCON")
+9 QUIT
+10 ;
PERRT ;
+1 LOCK +^INRHB("PURGE"):5
IF '$TEST
QUIT
+2 DO EPURGE^INTENV1(INPURGE,INCON)
+3 LOCK -^INRHB("PURGE")
+4 QUIT
+5 ;
GREEN ; general daily clean up - GREEN purge
+1 LOCK +^INRHB("PURGE"):1
IF '$TEST
WRITE !!,"Purge already running.",!
QUIT
+2 LOCK -^INRHB("PURGE")
+3 SET INPURGE=$$SITE
+4 WRITE !!,"This option will purge GIS transactions and errors."
+5 WRITE !,"It will keep "_(INPURGE*24)_" hours worth of transactions and errors."
+6 WRITE !,"All broken entries in the destination queue will be removed.",!
+7 IF '$$SURE(1)
QUIT
+8 SET INPURGE=INPURGE_"D"
+9 DO TASK("YELLOWT^INTENV","Purge GIS Trans & Err","INPURGE")
+10 QUIT
+11 ;
GREENT ;
+1 LOCK +^INRHB("PURGE"):5
IF '$TEST
QUIT
+2 DO TPURGE^INTENV1(INPURGE)
DO EPURGE^INTENV1(INPURGE)
DO DPURGE^INTENV1
+3 LOCK -^INRHB("PURGE")
+4 QUIT
+5 ;
YELLOW ; purge all by time
+1 LOCK +^INRHB("PURGE"):1
IF '$TEST
WRITE !!,"Purge already running.",!
QUIT
+2 LOCK -^INRHB("PURGE")
+3 WRITE !!,"This option will purge GIS transactions and errors."
+4 WRITE !,"It will keep 72 hours worth of transactions, purge all MFN's,"
+5 WRITE !,"keep 24 hours of errors and consolidate remaining errors.",!
+6 WRITE !,"All broken entries in the destination queue will be removed.",!
+7 IF '$$SURE(2)
QUIT
+8 DO TASK("YELLOWT^INTENV","Purge GIS Trans & Err")
+9 QUIT
+10 ;
YELLOWT ;
+1 LOCK +^INRHB("PURGE"):5
IF '$TEST
QUIT
+2 DO TPURGE^INTENV1("3D")
DO TPURGE^INTENV1("0D","*MASTER FILE*")
DO EPURGE^INTENV1("1D",1)
DO DPURGE^INTENV1
+3 LOCK -^INRHB("PURGE")
+4 QUIT
+5 ;
RED ; stop GIS and clean out all dynamic globals
+1 WRITE !!,"This will STOP all processes of the GIS and COMPLETELY"
+2 WRITE !,"DELETE all transactions, errors, and CLEAR all queues.",!
+3 IF '$$SURE(3)
QUIT
+4 WRITE !!,"Shutting down GIS..."
+5 DO SHUT^INTENV1
+6 WRITE "done.",!!,"Clearing all transactions, errors, and queues..."
+7 DO CLEAN^INTENV1
+8 WRITE "done.",!
+9 QUIT
+10 ;
DATA() ; ask for amount of data
+1 NEW INX,INOUT
SET INOUT=0
+2 FOR
READ !,"Enter amount of data to keep: ",INX:$GET(DTIME,300)
Begin DoDot:1
+3 IF '$LENGTH(INX)!(INX["^")
SET INOUT=1
SET INX=""
QUIT
+4 IF $EXTRACT("NONE",1,$LENGTH(INX))=INX
SET INX="0D"
SET INOUT=1
QUIT
+5 IF INX?1.N1U
IF "DHM"[$EXTRACT(INX,$LENGTH(INX))
SET INOUT=1
QUIT
+6 IF INX'["?"
WRITE *7," ??"
+7 WRITE !," Enter a code for the length of time to keep data."
+8 WRITE !," format: nL where n = number and L is a letter"
+9 WRITE !," D = days, H = hours, M = minute"
+10 WRITE !," You may also enter NONE to not keep any data.",!
End DoDot:1
IF INOUT
QUIT
+11 QUIT INX
+12 ;
TTYPE(INTTA) ; get transaction types to delete
+1 ; output: INTTA = array of TTs
+2 ;
+3 NEW C,INTT,INOUT
+4 FOR
READ !,"Enter Transaction Type(s) to delete: ",INTT:$GET(DTIME,300)
Begin DoDot:1
+5 IF INTT="^L"
DO TTLIST(.INTTA)
QUIT
+6 IF '$LENGTH(INTT)
SET INOUT=0
SET INTT=""
QUIT
+7 IF INTT["^"
SET INOUT=1
SET INTT=""
QUIT
+8 IF INTT["?"
Begin DoDot:2
+9 WRITE !," Transactions can be deleted based on the Tranasaction"
+10 WRITE !," Types entered here. You can use wild cards ""*"" to select"
+11 WRITE !," many types. If you enter nothing, all transactions"
+12 WRITE !," within the purge date range will be deleted."
+13 WRITE !," Enter ""^L"" to see what is selected so far."
+14 WRITE !," Enter ""^"" to exit."
End DoDot:2
QUIT
+15 SET C=$$TTCONV^INTENV1(INTT,.INTTA)
+16 WRITE " "_$TRANSLATE(C,"-")_" "_$SELECT($EXTRACT(INTT)="-":"de",1:"")_"selected"
End DoDot:1
IF $DATA(INOUT)
QUIT
+17 IF $DATA(INTTA)<10
SET INOUT=1
+18 QUIT INOUT
+19 ;
TTLIST(INTTA) ; list out selected TT
+1 ; input: INTTA = array of Tranaaction Types
+2 NEW I,Y,L,%
+3 SET I=0
SET L=$GET(IOSL,24)-4
SET %=""
+4 FOR Y=1:1
SET I=$ORDER(INTTA(I))
IF 'I
QUIT
IF Y>L
SET Y=0
SET %=$$CR^UTSRD
IF %
QUIT
WRITE !,INTTA(I)
+5 QUIT
+6 ;
DEST() ; select destination
+1 NEW DIC,Y
+2 SET DIC="^INRHD("
SET DIC(0)="AEMQZ"
SET DIC("S")="I $D(^INLHDEST(Y))"
+3 DO ^DIC
IF Y<0
SET Y=0
+4 QUIT +Y
+5 ;
SURE(INREP) ; are you sure question
+1 ; input: INREP = number of times to ask, max is three for now
+2 NEW I,P,X
+3 FOR I=1:1:INREP
Begin DoDot:1
+4 SET P=$SELECT(I=1:"Is this ok?",I=2:"Are you sure?",1:"This is going to delete a lot of data. Are you really sure?")
End DoDot:1
WRITE !
SET X=$$YN^UTSRD(" "_P_$CHAR(7)_" ;0")
IF 'X
QUIT
+5 WRITE !
QUIT X
+6 ;
ECONH ; help for consolidate question
+1 WRITE !," If YES, the error log will retain the most recent of each type of"
+2 WRITE !," error and delete the duplicates after the purge date."
+3 WRITE !," IF NO, only errors before the purge date will be deleted."
+4 QUIT
+5 ;
TASK(ZTRTN,ZTDESC,INSAVE) ; send routine to background
+1 ; input: ZTRTN = routine to run
+2 ; ZTDESC = Description of task
+3 NEW X,I
+4 SET X=$$YN^UTSRD("Do you want to run this in the background? ;1")
+5 IF X
KILL ZTDTH
SET ZTIO="NL:"
Begin DoDot:1
+6 FOR I=1:1
SET X=$PIECE($GET(INSAVE),",",I)
IF '$LENGTH(X)
QUIT
SET ZTSAVE(X)=""
End DoDot:1
DO ^%ZTLOAD
WRITE !,"Queued to background. ("_$GET(ZTSK)_")"
QUIT
+7 DO @ZTRTN
+8 QUIT
+9 ;
SITE() ; return # of days from GIS site parms
+1 NEW X
+2 SET X=$PIECE($GET(^INRHSITE(1,0)),U,11)
IF 'X
SET X=3
+3 QUIT X
+4 ;