Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: AZAXPAH

AZAXPAH.m

Go to the documentation of this file.
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