KMPDUTL ;OAK/RAK - CM Tools Utility ;9/1/2015
;;3.0;Capacity Management Tools;**3**;Jan 15, 2013;Build 42
;
QUEBKG(KMPDOPT,KMPDTIME,KMPDFREQ,KMPDDEL) ;-- queue background job
;-----------------------------------------------------------------------
; KMPDOPT.... Option name to queue (free text name in .01 field of
; OPTION file)
; KMPDTIME... Date/time to queue option (T@1400, etc)
; KMPDFREQ... Scheduling frequency (1D, etc)
; KMPDDEL.... Delete option if it already exists in file 19.2
; 0 - do not delete (quit if already scheduled)
; 1 - delete if already in file 19.2
;
; This API will queue an option from file #19 (OPTION) to run in file
; 19.2 (OPTION SCHEDULE).
;-----------------------------------------------------------------------
Q:$G(KMPDOPT)=""
Q:$G(KMPDTIME)=""
Q:$G(KMPDFREQ)=""
S KMPDDEL=+$G(KMPDDEL)
N DA,DIFROM,DIK,FDA,ERROR,IEN,IEN1,IENZ,TEXT,X,Y,Z
; Newing DIFROM will force reschedule when installing from KIDS
S:'$G(DT) DT=$$DT^XLFDT
; change to internal format
D FMDTI^KMPDU(.Z,KMPDTIME)
Q:Z(0)="^"!(Z(0)="")
S KMPDTIME=Z(0) K Z
S TEXT=KMPDOPT
; quit if not in file 19
S IEN=$O(^DIC(19,"B",TEXT,0)) Q:'IEN
S IEN1=$O(^DIC(19.2,"B",IEN,0))
; quit if already in file 19.2 and not KMPDDEL
Q:IEN1&('KMPDDEL)
; delete if in file 19.2
I IEN1 S DIK="^DIC(19.2,",DA=IEN1 D ^DIK
; add entry
S FDA($J,19.2,"+1,",.01)=IEN
; queued to run at what time
S FDA($J,19.2,"+1,",2)=KMPDTIME
; rescheduling frequency.
S FDA($J,19.2,"+1,",6)=KMPDFREQ
D UPDATE^DIE("","FDA($J)",.IENZ,"ERROR")
I $D(ERROR) D MSG^DIALOG("W","",60,10,"ERROR")
S IEN1=$O(^DIC(19.2,"B",IEN,0))
I '$G(^DIC(19.2,+IEN1,1)) D
.D MES^XPDUTL(" ERROR - Not able to reschedule "_KMPDOPT)
.D MES^XPDUTL(" Use 'Schedule/Unschedule Options' [XUTM SCHEDULE] to reschedule.")
;
Q
;
VERSION() ;-- extrinsic - return current version.
Q $P($T(+2^KMPDUTL),";",3)_"^"_$P($T(+2^KMPDUTL),";",5)
;
VRSNGET(KMPDAPPL) ;-- extrinsic function - get version^patches
;-----------------------------------------------------------------------
; KMPDAPPL... application:
; 0 - CM Tools
; 1 - SAGG
; 2 - RUM
;
; Return: Version^Patch^VersionInstallDate^PatchInstallDate
; null = no application
;-----------------------------------------------------------------------
;
Q:$G(KMPDAPPL)="" ""
Q:KMPDAPPL<0!(KMPDAPPL>2) ""
;
N DATA,VERSION S VERSION=""
;
; cm tools
I KMPDAPPL=0 D
.S DATA=$G(^KMPD(8973,1,KMPDAPPL))
.S VERSION=$P(DATA,U,2)_U_$P(DATA,U,4)_U_$P(DATA,U,3)_U_$P(DATA,U,5)
;
; all other applications
E D
.S DATA=$G(^KMPD(8973,1,KMPDAPPL))
.S VERSION=$P(DATA,U)_U_$P(DATA,U,3)_U_$P(DATA,U,2)_U_$P(DATA,U,4)
;
Q VERSION
;
PTCHINFO ; -- patch information: routine name ^ current version ^ current patch(es)
;;KMPDBD01^3.0^**3**
;;KMPDECH^3.0^
;;KMPDHU01^3.0^
;;KMPDHU02^3.0
;;KMPDHU03^3.0
;;KMPDHUA^3.0
;;KMPDPOST^3.0^
;;KMPDSS^3.0^
;;KMPDSS1^3.0^
;;KMPDSSD^3.0^
;;KMPDSSD1^3.0^
;;KMPDSSR^3.0^
;;KMPDSSS^3.0^**3**
;;KMPDTM^3.0^**3**
;;KMPDTP1^3.0^**3**
;;KMPDTP2^3.0^**3**
;;KMPDTP3^3.0^**3**
;;KMPDTP4^3.0^**3**
;;KMPDTP5^3.0^**3**
;;KMPDTP6^3.0^**3**
;;KMPDTP7^3.0^**3**
;;KMPDTU01^3.0^
;;KMPDTU02^3.0^
;;KMPDTU10^3.0^**3**
;;KMPDTU11^3.0^**3**
;;KMPDU^3.0^
;;KMPDU1^3.0^
;;KMPDU2^3.0^
;;KMPDU3^3.0^
;;KMPDU4^3.0
;;KMPDU5^3.0^
;;KMPDU11^3.0^
;;KMPDUG^3.0^
;;KMPDUG1^3.0^
;;KMPDUG2^3.0^
;;KMPDUGV^3.0^
;;KMPDUT^3.0^
;;KMPDUT1^3.0^
;;KMPDUT2^3.0^
;;KMPDUT4^3.0^
;;KMPDUT4A^3.0^
;;KMPDUT4B^3.0^
;;KMPDUT4C^3.0^
;;KMPDUT5^3.0^
;;KMPDUTL^3.0^**3**
;;KMPDUTL1^3.0^
;;KMPDUTL2^3.0^
;;KMPDUTL3^3.0^
;;KMPDUTL4^3.0^
;;KMPDUTL5^3.0^
;;KMPDUTL6^3.0^
;;KMPDUTL7^3.0^
;;KMPDUTL8^3.0^
;;KMPDRDAT^3.0^**3**
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HKMPDUTL 3938 printed Nov 22, 2024@16:51:29 Page 2
KMPDUTL ;OAK/RAK - CM Tools Utility ;9/1/2015
+1 ;;3.0;Capacity Management Tools;**3**;Jan 15, 2013;Build 42
+2 ;
QUEBKG(KMPDOPT,KMPDTIME,KMPDFREQ,KMPDDEL) ;-- queue background job
+1 ;-----------------------------------------------------------------------
+2 ; KMPDOPT.... Option name to queue (free text name in .01 field of
+3 ; OPTION file)
+4 ; KMPDTIME... Date/time to queue option (T@1400, etc)
+5 ; KMPDFREQ... Scheduling frequency (1D, etc)
+6 ; KMPDDEL.... Delete option if it already exists in file 19.2
+7 ; 0 - do not delete (quit if already scheduled)
+8 ; 1 - delete if already in file 19.2
+9 ;
+10 ; This API will queue an option from file #19 (OPTION) to run in file
+11 ; 19.2 (OPTION SCHEDULE).
+12 ;-----------------------------------------------------------------------
+13 if $GET(KMPDOPT)=""
QUIT
+14 if $GET(KMPDTIME)=""
QUIT
+15 if $GET(KMPDFREQ)=""
QUIT
+16 SET KMPDDEL=+$GET(KMPDDEL)
+17 NEW DA,DIFROM,DIK,FDA,ERROR,IEN,IEN1,IENZ,TEXT,X,Y,Z
+18 ; Newing DIFROM will force reschedule when installing from KIDS
+19 if '$GET(DT)
SET DT=$$DT^XLFDT
+20 ; change to internal format
+21 DO FMDTI^KMPDU(.Z,KMPDTIME)
+22 if Z(0)="^"!(Z(0)="")
QUIT
+23 SET KMPDTIME=Z(0)
KILL Z
+24 SET TEXT=KMPDOPT
+25 ; quit if not in file 19
+26 SET IEN=$ORDER(^DIC(19,"B",TEXT,0))
if 'IEN
QUIT
+27 SET IEN1=$ORDER(^DIC(19.2,"B",IEN,0))
+28 ; quit if already in file 19.2 and not KMPDDEL
+29 if IEN1&('KMPDDEL)
QUIT
+30 ; delete if in file 19.2
+31 IF IEN1
SET DIK="^DIC(19.2,"
SET DA=IEN1
DO ^DIK
+32 ; add entry
+33 SET FDA($JOB,19.2,"+1,",.01)=IEN
+34 ; queued to run at what time
+35 SET FDA($JOB,19.2,"+1,",2)=KMPDTIME
+36 ; rescheduling frequency.
+37 SET FDA($JOB,19.2,"+1,",6)=KMPDFREQ
+38 DO UPDATE^DIE("","FDA($J)",.IENZ,"ERROR")
+39 IF $DATA(ERROR)
DO MSG^DIALOG("W","",60,10,"ERROR")
+40 SET IEN1=$ORDER(^DIC(19.2,"B",IEN,0))
+41 IF '$GET(^DIC(19.2,+IEN1,1))
Begin DoDot:1
+42 DO MES^XPDUTL(" ERROR - Not able to reschedule "_KMPDOPT)
+43 DO MES^XPDUTL(" Use 'Schedule/Unschedule Options' [XUTM SCHEDULE] to reschedule.")
End DoDot:1
+44 ;
+45 QUIT
+46 ;
VERSION() ;-- extrinsic - return current version.
+1 QUIT $PIECE($TEXT(+2^KMPDUTL),";",3)_"^"_$PIECE($TEXT(+2^KMPDUTL),";",5)
+2 ;
VRSNGET(KMPDAPPL) ;-- extrinsic function - get version^patches
+1 ;-----------------------------------------------------------------------
+2 ; KMPDAPPL... application:
+3 ; 0 - CM Tools
+4 ; 1 - SAGG
+5 ; 2 - RUM
+6 ;
+7 ; Return: Version^Patch^VersionInstallDate^PatchInstallDate
+8 ; null = no application
+9 ;-----------------------------------------------------------------------
+10 ;
+11 if $GET(KMPDAPPL)=""
QUIT ""
+12 if KMPDAPPL<0!(KMPDAPPL>2)
QUIT ""
+13 ;
+14 NEW DATA,VERSION
SET VERSION=""
+15 ;
+16 ; cm tools
+17 IF KMPDAPPL=0
Begin DoDot:1
+18 SET DATA=$GET(^KMPD(8973,1,KMPDAPPL))
+19 SET VERSION=$PIECE(DATA,U,2)_U_$PIECE(DATA,U,4)_U_$PIECE(DATA,U,3)_U_$PIECE(DATA,U,5)
End DoDot:1
+20 ;
+21 ; all other applications
+22 IF '$TEST
Begin DoDot:1
+23 SET DATA=$GET(^KMPD(8973,1,KMPDAPPL))
+24 SET VERSION=$PIECE(DATA,U)_U_$PIECE(DATA,U,3)_U_$PIECE(DATA,U,2)_U_$PIECE(DATA,U,4)
End DoDot:1
+25 ;
+26 QUIT VERSION
+27 ;
PTCHINFO ; -- patch information: routine name ^ current version ^ current patch(es)
+1 ;;KMPDBD01^3.0^**3**
+2 ;;KMPDECH^3.0^
+3 ;;KMPDHU01^3.0^
+4 ;;KMPDHU02^3.0
+5 ;;KMPDHU03^3.0
+6 ;;KMPDHUA^3.0
+7 ;;KMPDPOST^3.0^
+8 ;;KMPDSS^3.0^
+9 ;;KMPDSS1^3.0^
+10 ;;KMPDSSD^3.0^
+11 ;;KMPDSSD1^3.0^
+12 ;;KMPDSSR^3.0^
+13 ;;KMPDSSS^3.0^**3**
+14 ;;KMPDTM^3.0^**3**
+15 ;;KMPDTP1^3.0^**3**
+16 ;;KMPDTP2^3.0^**3**
+17 ;;KMPDTP3^3.0^**3**
+18 ;;KMPDTP4^3.0^**3**
+19 ;;KMPDTP5^3.0^**3**
+20 ;;KMPDTP6^3.0^**3**
+21 ;;KMPDTP7^3.0^**3**
+22 ;;KMPDTU01^3.0^
+23 ;;KMPDTU02^3.0^
+24 ;;KMPDTU10^3.0^**3**
+25 ;;KMPDTU11^3.0^**3**
+26 ;;KMPDU^3.0^
+27 ;;KMPDU1^3.0^
+28 ;;KMPDU2^3.0^
+29 ;;KMPDU3^3.0^
+30 ;;KMPDU4^3.0
+31 ;;KMPDU5^3.0^
+32 ;;KMPDU11^3.0^
+33 ;;KMPDUG^3.0^
+34 ;;KMPDUG1^3.0^
+35 ;;KMPDUG2^3.0^
+36 ;;KMPDUGV^3.0^
+37 ;;KMPDUT^3.0^
+38 ;;KMPDUT1^3.0^
+39 ;;KMPDUT2^3.0^
+40 ;;KMPDUT4^3.0^
+41 ;;KMPDUT4A^3.0^
+42 ;;KMPDUT4B^3.0^
+43 ;;KMPDUT4C^3.0^
+44 ;;KMPDUT5^3.0^
+45 ;;KMPDUTL^3.0^**3**
+46 ;;KMPDUTL1^3.0^
+47 ;;KMPDUTL2^3.0^
+48 ;;KMPDUTL3^3.0^
+49 ;;KMPDUTL4^3.0^
+50 ;;KMPDUTL5^3.0^
+51 ;;KMPDUTL6^3.0^
+52 ;;KMPDUTL7^3.0^
+53 ;;KMPDUTL8^3.0^
+54 ;;KMPDRDAT^3.0^**3**