AZAXPAH ;IHS/OIRM/DSD/AEF - DISPLAY PATCH APPLICATION HISTORY [ 02/11/2004 2:44 PM ]
;;V1.0;ANNE'S SPECIAL ROUTINES;;FEB 11, 2004
;
;*** TESTING - AEF *** NEW ROUTINE
;
DESC ;----- ROUTINE DESCRIPTION
;;
;; This option produces a listing of all patches that have
;; been installed for the selected package and version.
;;
;;$$END
;
EN ;EP -- MAIN ENTRY POINT
;
D TXT
D SELECT
Q
EN2 ;EP -- MAIN ENTRY POINT #2
;
W !!,"This entry point produces a listing of all patches that"
W !,"have been installed for the current version of all packages."
W !!
D HOME^%ZIS
D ^XBKVAR
D QUE("DQ2^AZAXPAH",,"PATCH APPLICATION HISTORY")
Q
SELECT ;EP -- SELECT WHICH PACKAGE AND VERSION FOR PAH DISPLAY
;
N AZAPIEN,AZAVIEN,ZTSAVE
;
D HOME^%ZIS
D ^XBKVAR
;
D PKG(.AZAPIEN)
Q:AZAPIEN'>0
;
D VER(AZAPIEN,.AZAVIEN)
Q:AZAVIEN'>0
;
S ZTSAVE("AZAPIEN")=""
S ZTSAVE("AZAVIEN")=""
D QUE("DQ^AZAXPAH",.ZTSAVE,"PATCH APPLICATION HISTORY")
Q
CUR(X) ;----- DISPLAY PATCH APPLICATION HISTORY FOR CURRENT VERSION
;
; X = PACKAGE NAME
;
N AZACVER,AZAPIEN,AZAPKG,AZAVIEN,ZTSAVE
;
D HOME^%ZIS
D ^XBKVAR
;
S AZAPIEN=$$PIEN^AZAXPAH(X)
;
S AZACVER=$$CVER^AZAXPAH(AZAPIEN)
;
S AZAVIEN=$$VIEN^AZAXPAH(AZACVER,AZAPIEN)
;
S ZTSAVE("PIEN")=""
S ZTSAVE("VIEN")=""
;
D QUE("DQ^AZAXPAH",.ZTSAVE,"PATCH APPLICATION HISTORY")
;
Q
PKG(AZAPIEN) ;
;----- ASKS PACKAGE AND RETURNS PACKAGE IEN
;
N DIC,X,Y
S DIC="^DIC(9.4,"
S DIC(0)="AEQM"
D ^DIC
I $D(DTOUT)!($D(DUOUT)) S Y=-1
S AZAPIEN=+Y
Q
VER(AZAPIEN,AZAVIEN) ;
;----- ASKS VERSION AND RETURNS VERSION IEN
;
N DIC,X,Y
S DA(1)=AZAPIEN
S DIC="^DIC(9.4,"_DA(1)_",22,"
S DIC(0)="AEQ"
D ^DIC
I $D(DTOUT)!($D(DUOUT)) S Y=-1
S AZAVIEN=+Y
Q
DQ ;EP -- QUEUED JOB STARTS HERE
;
; INCOMING VARIABLES:
; AZAPIEN = PACKAGE IEN
; AZAVIEN = VERSION IEN
;
N AZAOUT
;
D PRT(AZAPIEN,AZAVIEN,.AZAOUT)
Q:AZAOUT
D ^%ZISC
D PAWS(.AZAOUT)
Q
DQ2 ;EP -- QUEUED JOB FROM EN2 STARTS HERE
;
N AZACUR,AZANAME,AZAOUT,AZAPIEN,AZAVIEN
;
S AZAOUT=0
;
D NAMES(.AZANAME)
;
S AZANAME=""
F S AZANAME=$O(AZANAME(AZANAME)) Q:AZANAME']"" D Q:AZAOUT
. S AZAPIEN=$O(AZANAME(AZANAME,0))
. Q:'AZAPIEN
. S AZACUR=$G(^DIC(9.4,AZAPIEN,"VERSION"))
. Q:AZACUR']""
. S AZAVIEN=$O(^DIC(9.4,AZAPIEN,22,"B",AZACUR,0))
. Q:'AZAVIEN
. D PRT(AZAPIEN,AZAVIEN,.AZAOUT)
. Q:AZAOUT
. D PAWS(.AZAOUT)
;
D ^%ZISC
Q
PRT(AZAPIEN,AZAVIEN,AZAOUT) ;
;----- PRINT THE REPORT
N AZABY,AZADATA,AZADATA,AZADATE,AZAINSBY,AZAINST,AZANAME,AZAPAGE,AZAPCH,AZAVER,X
;
S AZADATA=$G(^DIC(9.4,AZAPIEN,22,AZAVIEN,0))
S AZAVER=$P(AZADATA,U)
S AZAINST=$$SLDATE($P(AZADATA,U,3))
S AZAINSBY=$$INSBY($P(AZADATA,U,4))
S AZANAME=$P($G(^DIC(9.4,AZAPIEN,0)),U)
S AZAPAGE=0
S AZAOUT=0
;
D HDR(AZANAME,AZAVER,.AZAPAGE,.AZAOUT)
Q:$G(AZAOUT)
;
W !!,AZANAME," ",AZAVER," INSTALLED ON ",AZAINST," BY ",AZAINSBY
W !
;
I '$O(^DIC(9.4,AZAPIEN,22,AZAVIEN,"PAH",0)) D Q
. W !?10,"No patches found",!
;
S AZAOUT=0
S X=0
F S X=$O(^DIC(9.4,AZAPIEN,22,AZAVIEN,"PAH",X)) Q:'X D Q:$G(AZAOUT)
. S AZADATA=$G(^DIC(9.4,AZAPIEN,22,AZAVIEN,"PAH",X,0))
. S AZAPCH=$P(AZADATA,U)
. S AZADATE=$P(AZADATA,U,2)
. I AZADATE]"" S AZADATE=$$SLDATE(AZADATE)
. S AZABY=$P(AZADATA,U,3)
. I AZABY S AZABY=$P($G(^VA(200,AZABY,0)),U)
. I $Y>(IOSL-5) D HDR(AZANAME,AZAVER,.AZAPAGE,.AZAOUT)
. Q:$G(AZAOUT)
. W !,AZAPCH
. W ?15,AZADATE
. W ?30,AZABY
Q
HDR(AZANAME,AZAVER,AZAPAGE,AZAOUT) ;
;----- PRINT HEADER
;
N DIR,X,Y
;
I $E(IOST)="C",$G(AZAPAGE) S DIR(0)="E" D ^DIR K DIR I 'Y S AZAOUT=1 Q
;
S AZAPAGE=$G(AZAPAGE)+1
W @IOF
W !,AZANAME," VERSION ",AZAVER," PATCH APPLICATION HISTORY"
W !?49,$$NOW
W " PAGE ",AZAPAGE
W !,"PATCH"
W ?15,"DATE APPLIED"
W ?30,"APPLIED BY"
W !
F I=1:1:IOM W "-"
Q
NAMES(AZANAME) ;
;----- BUILD ARRAY OF PACKAGE NAMES
;
N X
;
S X=0
F S X=$O(^DIC(9.4,X)) Q:'X D
. S AZANAME=$P($G(^DIC(9.4,X,0)),U)
. Q:AZANAME']""
. S AZANAME(AZANAME,X)=""
Q
PIEN(X) ;----- GET PACKAGE IEN
;
; X = PACKAGE NAME
;
N DIC,Y
S DIC="^DIC(9.4,"
S DIC(0)=""
D ^DIC
Q +Y
CVER(X) ;----- GET CURRENT VERSION
;
; X = PACKAGE IEN
;
N Y
S Y=""
I X S Y=$P($G(^DIC(9.4,X,"VERSION")),U)
Q Y
VIEN(X,AZAPKG) ;
;----- GET VERSION IEN
;
; AZAPKG = PACKAGE IEN
; X = VERSION NUMBER
;
N Y
S DIC="^DIC(9.4,"_AZAPKG_",22,"
S DIC(0)=""
D ^DIC
Q +Y
TXT ;----- PRINT OPTION DESCRIPTION
;
N I,X
F I=1:1 S X=$P($T(DESC+I),";",3) Q:X["$$END" W !,X
Q
PAWS(AZAOUT) ;
;----- ISSUE 'RETURN' PROMPT
;
N DIR,X,Y
Q:$E($G(IOST),1,2)'="C-"
W !
S DIR(0)="E"
D ^DIR
I 'Y S AZAOUT=1
Q
NOW() ;----- RETURNS CURRENT DATE/TIME
;
N %,%H,%I,X
D ^XBKVAR
D NOW^%DTC
S Y=DT
X ^DD("DD")
Q Y_" "_$E($P(%,".",2),1,2)_":"_$E($P(%,".",2),3,4)
;
SLDATE(X) ;
;----- RETURNS DATE IN MM/DD/YYYY FORMAT
;
; X = INTERNAL FILEMANAGER DATE IN YYYMMDD FORMAT
;
N Y
S Y=""
I X D
. S X=$P(X,".")
. Q:$L(X)'=7
. S Y=$E(X,4,5)_"/"_$E(X,6,7)_"/"_($E(X,1,3)+1700)
Q Y
INSBY(X) ;----- INSTALLED BY
;
; X = NEW PERSON IEN
;
N Y
S Y=""
I X S Y=$P($G(^VA(200,X,0)),U)
Q Y
QUE(ZTRTN,ZTSAVE,ZTDESC) ;
;----- QUEUEING CODE
;
N %ZIS,IO,POP,ZTIO,ZTSK
S %ZIS="Q"
D ^%ZIS
Q:POP
I $D(IO("Q")) D Q
. K IO("Q")
. S ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL
. D ^%ZTLOAD
. I $G(ZTSK) W !,"Task #",ZTSK," queued"
D @ZTRTN
Q
AZAXPAH ;IHS/OIRM/DSD/AEF - DISPLAY PATCH APPLICATION HISTORY [ 02/11/2004 2:44 PM ]
+1 ;;V1.0;ANNE'S SPECIAL ROUTINES;;FEB 11, 2004
+2 ;
+3 ;*** TESTING - AEF *** NEW ROUTINE
+4 ;
DESC ;----- ROUTINE DESCRIPTION
+1 ;;
+2 ;; This option produces a listing of all patches that have
+3 ;; been installed for the selected package and version.
+4 ;;
+5 ;;$$END
+6 ;
EN ;EP -- MAIN ENTRY POINT
+1 ;
+2 DO TXT
+3 DO SELECT
+4 QUIT
EN2 ;EP -- MAIN ENTRY POINT #2
+1 ;
+2 WRITE !!,"This entry point produces a listing of all patches that"
+3 WRITE !,"have been installed for the current version of all packages."
+4 WRITE !!
+5 DO HOME^%ZIS
+6 DO ^XBKVAR
+7 DO QUE("DQ2^AZAXPAH",,"PATCH APPLICATION HISTORY")
+8 QUIT
SELECT ;EP -- SELECT WHICH PACKAGE AND VERSION FOR PAH DISPLAY
+1 ;
+2 NEW AZAPIEN,AZAVIEN,ZTSAVE
+3 ;
+4 DO HOME^%ZIS
+5 DO ^XBKVAR
+6 ;
+7 DO PKG(.AZAPIEN)
+8 IF AZAPIEN'>0
QUIT
+9 ;
+10 DO VER(AZAPIEN,.AZAVIEN)
+11 IF AZAVIEN'>0
QUIT
+12 ;
+13 SET ZTSAVE("AZAPIEN")=""
+14 SET ZTSAVE("AZAVIEN")=""
+15 DO QUE("DQ^AZAXPAH",.ZTSAVE,"PATCH APPLICATION HISTORY")
+16 QUIT
CUR(X) ;----- DISPLAY PATCH APPLICATION HISTORY FOR CURRENT VERSION
+1 ;
+2 ; X = PACKAGE NAME
+3 ;
+4 NEW AZACVER,AZAPIEN,AZAPKG,AZAVIEN,ZTSAVE
+5 ;
+6 DO HOME^%ZIS
+7 DO ^XBKVAR
+8 ;
+9 SET AZAPIEN=$$PIEN^AZAXPAH(X)
+10 ;
+11 SET AZACVER=$$CVER^AZAXPAH(AZAPIEN)
+12 ;
+13 SET AZAVIEN=$$VIEN^AZAXPAH(AZACVER,AZAPIEN)
+14 ;
+15 SET ZTSAVE("PIEN")=""
+16 SET ZTSAVE("VIEN")=""
+17 ;
+18 DO QUE("DQ^AZAXPAH",.ZTSAVE,"PATCH APPLICATION HISTORY")
+19 ;
+20 QUIT
PKG(AZAPIEN) ;
+1 ;----- ASKS PACKAGE AND RETURNS PACKAGE IEN
+2 ;
+3 NEW DIC,X,Y
+4 SET DIC="^DIC(9.4,"
+5 SET DIC(0)="AEQM"
+6 DO ^DIC
+7 IF $DATA(DTOUT)!($DATA(DUOUT))
SET Y=-1
+8 SET AZAPIEN=+Y
+9 QUIT
VER(AZAPIEN,AZAVIEN) ;
+1 ;----- ASKS VERSION AND RETURNS VERSION IEN
+2 ;
+3 NEW DIC,X,Y
+4 SET DA(1)=AZAPIEN
+5 SET DIC="^DIC(9.4,"_DA(1)_",22,"
+6 SET DIC(0)="AEQ"
+7 DO ^DIC
+8 IF $DATA(DTOUT)!($DATA(DUOUT))
SET Y=-1
+9 SET AZAVIEN=+Y
+10 QUIT
DQ ;EP -- QUEUED JOB STARTS HERE
+1 ;
+2 ; INCOMING VARIABLES:
+3 ; AZAPIEN = PACKAGE IEN
+4 ; AZAVIEN = VERSION IEN
+5 ;
+6 NEW AZAOUT
+7 ;
+8 DO PRT(AZAPIEN,AZAVIEN,.AZAOUT)
+9 IF AZAOUT
QUIT
+10 DO ^%ZISC
+11 DO PAWS(.AZAOUT)
+12 QUIT
DQ2 ;EP -- QUEUED JOB FROM EN2 STARTS HERE
+1 ;
+2 NEW AZACUR,AZANAME,AZAOUT,AZAPIEN,AZAVIEN
+3 ;
+4 SET AZAOUT=0
+5 ;
+6 DO NAMES(.AZANAME)
+7 ;
+8 SET AZANAME=""
+9 FOR
SET AZANAME=$ORDER(AZANAME(AZANAME))
IF AZANAME']""
QUIT
Begin DoDot:1
+10 SET AZAPIEN=$ORDER(AZANAME(AZANAME,0))
+11 IF 'AZAPIEN
QUIT
+12 SET AZACUR=$GET(^DIC(9.4,AZAPIEN,"VERSION"))
+13 IF AZACUR']""
QUIT
+14 SET AZAVIEN=$ORDER(^DIC(9.4,AZAPIEN,22,"B",AZACUR,0))
+15 IF 'AZAVIEN
QUIT
+16 DO PRT(AZAPIEN,AZAVIEN,.AZAOUT)
+17 IF AZAOUT
QUIT
+18 DO PAWS(.AZAOUT)
End DoDot:1
IF AZAOUT
QUIT
+19 ;
+20 DO ^%ZISC
+21 QUIT
PRT(AZAPIEN,AZAVIEN,AZAOUT) ;
+1 ;----- PRINT THE REPORT
+2 NEW AZABY,AZADATA,AZADATA,AZADATE,AZAINSBY,AZAINST,AZANAME,AZAPAGE,AZAPCH,AZAVER,X
+3 ;
+4 SET AZADATA=$GET(^DIC(9.4,AZAPIEN,22,AZAVIEN,0))
+5 SET AZAVER=$PIECE(AZADATA,U)
+6 SET AZAINST=$$SLDATE($PIECE(AZADATA,U,3))
+7 SET AZAINSBY=$$INSBY($PIECE(AZADATA,U,4))
+8 SET AZANAME=$PIECE($GET(^DIC(9.4,AZAPIEN,0)),U)
+9 SET AZAPAGE=0
+10 SET AZAOUT=0
+11 ;
+12 DO HDR(AZANAME,AZAVER,.AZAPAGE,.AZAOUT)
+13 IF $GET(AZAOUT)
QUIT
+14 ;
+15 WRITE !!,AZANAME," ",AZAVER," INSTALLED ON ",AZAINST," BY ",AZAINSBY
+16 WRITE !
+17 ;
+18 IF '$ORDER(^DIC(9.4,AZAPIEN,22,AZAVIEN,"PAH",0))
Begin DoDot:1
+19 WRITE !?10,"No patches found",!
End DoDot:1
QUIT
+20 ;
+21 SET AZAOUT=0
+22 SET X=0
+23 FOR
SET X=$ORDER(^DIC(9.4,AZAPIEN,22,AZAVIEN,"PAH",X))
IF 'X
QUIT
Begin DoDot:1
+24 SET AZADATA=$GET(^DIC(9.4,AZAPIEN,22,AZAVIEN,"PAH",X,0))
+25 SET AZAPCH=$PIECE(AZADATA,U)
+26 SET AZADATE=$PIECE(AZADATA,U,2)
+27 IF AZADATE]""
SET AZADATE=$$SLDATE(AZADATE)
+28 SET AZABY=$PIECE(AZADATA,U,3)
+29 IF AZABY
SET AZABY=$PIECE($GET(^VA(200,AZABY,0)),U)
+30 IF $Y>(IOSL-5)
DO HDR(AZANAME,AZAVER,.AZAPAGE,.AZAOUT)
+31 IF $GET(AZAOUT)
QUIT
+32 WRITE !,AZAPCH
+33 WRITE ?15,AZADATE
+34 WRITE ?30,AZABY
End DoDot:1
IF $GET(AZAOUT)
QUIT
+35 QUIT
HDR(AZANAME,AZAVER,AZAPAGE,AZAOUT) ;
+1 ;----- PRINT HEADER
+2 ;
+3 NEW DIR,X,Y
+4 ;
+5 IF $EXTRACT(IOST)="C"
IF $GET(AZAPAGE)
SET DIR(0)="E"
DO ^DIR
KILL DIR
IF 'Y
SET AZAOUT=1
QUIT
+6 ;
+7 SET AZAPAGE=$GET(AZAPAGE)+1
+8 WRITE @IOF
+9 WRITE !,AZANAME," VERSION ",AZAVER," PATCH APPLICATION HISTORY"
+10 WRITE !?49,$$NOW
+11 WRITE " PAGE ",AZAPAGE
+12 WRITE !,"PATCH"
+13 WRITE ?15,"DATE APPLIED"
+14 WRITE ?30,"APPLIED BY"
+15 WRITE !
+16 FOR I=1:1:IOM
WRITE "-"
+17 QUIT
NAMES(AZANAME) ;
+1 ;----- BUILD ARRAY OF PACKAGE NAMES
+2 ;
+3 NEW X
+4 ;
+5 SET X=0
+6 FOR
SET X=$ORDER(^DIC(9.4,X))
IF 'X
QUIT
Begin DoDot:1
+7 SET AZANAME=$PIECE($GET(^DIC(9.4,X,0)),U)
+8 IF AZANAME']""
QUIT
+9 SET AZANAME(AZANAME,X)=""
End DoDot:1
+10 QUIT
PIEN(X) ;----- GET PACKAGE IEN
+1 ;
+2 ; X = PACKAGE NAME
+3 ;
+4 NEW DIC,Y
+5 SET DIC="^DIC(9.4,"
+6 SET DIC(0)=""
+7 DO ^DIC
+8 QUIT +Y
CVER(X) ;----- GET CURRENT VERSION
+1 ;
+2 ; X = PACKAGE IEN
+3 ;
+4 NEW Y
+5 SET Y=""
+6 IF X
SET Y=$PIECE($GET(^DIC(9.4,X,"VERSION")),U)
+7 QUIT Y
VIEN(X,AZAPKG) ;
+1 ;----- GET VERSION IEN
+2 ;
+3 ; AZAPKG = PACKAGE IEN
+4 ; X = VERSION NUMBER
+5 ;
+6 NEW Y
+7 SET DIC="^DIC(9.4,"_AZAPKG_",22,"
+8 SET DIC(0)=""
+9 DO ^DIC
+10 QUIT +Y
TXT ;----- PRINT OPTION DESCRIPTION
+1 ;
+2 NEW I,X
+3 FOR I=1:1
SET X=$PIECE($TEXT(DESC+I),";",3)
IF X["$$END"
QUIT
WRITE !,X
+4 QUIT
PAWS(AZAOUT) ;
+1 ;----- ISSUE 'RETURN' PROMPT
+2 ;
+3 NEW DIR,X,Y
+4 IF $EXTRACT($GET(IOST),1,2)'="C-"
QUIT
+5 WRITE !
+6 SET DIR(0)="E"
+7 DO ^DIR
+8 IF 'Y
SET AZAOUT=1
+9 QUIT
NOW() ;----- RETURNS CURRENT DATE/TIME
+1 ;
+2 NEW %,%H,%I,X
+3 DO ^XBKVAR
+4 DO NOW^%DTC
+5 SET Y=DT
+6 XECUTE ^DD("DD")
+7 QUIT Y_" "_$EXTRACT($PIECE(%,".",2),1,2)_":"_$EXTRACT($PIECE(%,".",2),3,4)
+8 ;
SLDATE(X) ;
+1 ;----- RETURNS DATE IN MM/DD/YYYY FORMAT
+2 ;
+3 ; X = INTERNAL FILEMANAGER DATE IN YYYMMDD FORMAT
+4 ;
+5 NEW Y
+6 SET Y=""
+7 IF X
Begin DoDot:1
+8 SET X=$PIECE(X,".")
+9 IF $LENGTH(X)'=7
QUIT
+10 SET Y=$EXTRACT(X,4,5)_"/"_$EXTRACT(X,6,7)_"/"_($EXTRACT(X,1,3)+1700)
End DoDot:1
+11 QUIT Y
INSBY(X) ;----- INSTALLED BY
+1 ;
+2 ; X = NEW PERSON IEN
+3 ;
+4 NEW Y
+5 SET Y=""
+6 IF X
SET Y=$PIECE($GET(^VA(200,X,0)),U)
+7 QUIT Y
QUE(ZTRTN,ZTSAVE,ZTDESC) ;
+1 ;----- QUEUEING CODE
+2 ;
+3 NEW %ZIS,IO,POP,ZTIO,ZTSK
+4 SET %ZIS="Q"
+5 DO ^%ZIS
+6 IF POP
QUIT
+7 IF $DATA(IO("Q"))
Begin DoDot:1
+8 KILL IO("Q")
+9 SET ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL
+10 DO ^%ZTLOAD
+11 IF $GET(ZTSK)
WRITE !,"Task #",ZTSK," queued"
End DoDot:1
QUIT
+12 DO @ZTRTN
+13 QUIT