AZFMENV ;IHS/OIT/ENM - PHARMACY ENVIRONMENT CHECK [ 02/13/2006 2:54 PM ]
;;IHS PHARMACY MODIFICATIONS;;
ALLPKG ;LOOP ON PACKAGE FILE "B" XREF
S AZFMSITE="",PKRN="",AZASUFAC="",AZFMCT=1
I $G(DUZ)'>0!('$D(DUZ(0))) W !,"YOUR DUZ VARIABLES ARE NOT DEFINED! AT THE PROMPT, ENTER 'D ^XUP'",!,"AND RUN THIS PROGRAM AFTERWARDS.",! Q
I $G(DUZ(2))>0 S AZFMSITE=$P($G(^DIC(4,DUZ(2),0)),"^",1),AZASUFAC=$P($G(^AUTTLOC(DUZ(2),0)),"^",10) W !,"SITE NAME: ",AZFMSITE_" "_AZASUFAC,!
W !,"SOURCE: Package File - Package Name - Current Version - Last Patch",!
W !,"PACKAGE NAME",?40,"CURRENT",?50,"LATEST",!,?40,"VERSION",?50,"PATCH/DATE",!,"------------",?40,"---------------",?50,"----------"
S AZFM="",LPATCH="",LPAT=""
F NA=0:0 S AZFM=$O(^DIC(9.4,"B",AZFM)) Q:AZFM="" D PKGWR
;D XBC ;MOVE XTMP GBL TO UNIX
D OUT
Q
PKGWR S AZVER=$$VERSION^XPDUTL(AZFM),LPATCH=$$LAST^AZFMENV2(AZFM,AZVER),LPATCH=$S(LPATCH'[-1:LPATCH,1:"") D DTFIX
I LPATCH="" S LPAT=""
I LPATCH]"" S LPAT=$P(LPATCH,"^",1)_" / "_$P(LPATCH,"^",2)
;GRAB THE PREFIX
S PKRN=$O(^DIC(9.4,"B",AZFM,"")) S:'PKRN PKRN=""
S PREFIX=$P($G(^DIC(9.4,PKRN,0)),"^",2)
W !,AZFM_"-("_PREFIX_")",?40,AZVER,?50,LPAT I AZFM="IHS V FILES 200 CONVERSION" D PCC2
S ^AZFMENV(AZFMCT)=AZASUFAC_"^"_AZFM_"^"_AZVER_"^"_LPAT
S AZFMCT=AZFMCT+1
Q
PCC2 S PCCF200=$P($G(^AUTTSITE(1,0)),"^",22) I PCCF200="" S PCCF200="No"
I PCCF200=1 S PCCF200="YES"
W !,?30,"IHS V Files 200 Conversion Done?// ",PCCF200
Q
DOONE ;DO ONE RECORD FOR TESTING ONLY
S AZFM="ADVERSE REACTION TRACKING" D PKGWR
D OUT
Q
DTFIX Q:'+LPATCH
S Y=$P(LPATCH,"^",2) X ^DD("DD") S $P(LPATCH,"^",2)=" "_Y
Q
OUT ;
W !!,"END OF PACKAGE FILE PROFILE CHECK!"
K NA,AZFM,AZVER,LPATCH,PCCF200,AZASUFAC
Q
PFIX S AZFMSITE="",PKRN=""
I $G(DUZ)'>0!('$D(DUZ(0))) W !,"YOUR DUZ VARIABLES ARE NOT DEFINED! AT THE PROMPT, ENTER 'D ^XUP'",!,"AND RUN THIS PROGRAM AFTERWARDS.",! Q
I $G(DUZ(2))>0 S AZFMSITE=$P($G(^DIC(4,DUZ(2),0)),"^",1) W !,"SITE NAME: ",AZFMSITE,!
W !,"SOURCE: Package File - Package Name - Current Version - Last Patch",!
W !,"PACKAGE NAME",?40,"CURRENT",?50,"LATEST",!,?40,"VERSION",?50,"PATCH/DATE",!,"------------",?40,"---------------",?50,"----------"
S AZFM="",LPATCH="",LPAT=""
F NA=0:0 S AZFM=$O(^DIC(9.4,"B",AZFM)) Q:AZFM="" D PGWR
D OP2
D OUT
Q
PGWR S AZVER=$$VERSION^XPDUTL(AZFM),LPATCH=$$LAST^AZFMENV2(AZFM,AZVER),LPATCH=$S(LPATCH'[-1:LPATCH,1:"") D DTFIX
I LPATCH="" S LPAT=""
I LPATCH]"" S LPAT=$P(LPATCH,"^",1)_" / "_$P(LPATCH,"^",2)
;GRAB THE PREFIX
S PKRN=$O(^DIC(9.4,"B",AZFM,"")) S:'PKRN PKRN=""
S PREFIX=$P($G(^DIC(9.4,PKRN,0)),"^",2)
;W !,AZFM_"-("_PREFIX_")",?40,AZVER,?50,LPAT I AZFM="IHS V FILES 200 CONVERSION" D PCC2
S ENM(PREFIX)=AZFM_"^"_AZVER_"^"_LPAT
Q
OP2 ;
S PFX="",AZFM1="",AZVER1="",APAT1=""
F S PFX=$O(ENM(PFX)) Q:'PFX S AZFM1=$P($G(ENM(PFX)),"^",1),AZVER1=$P($G(ENM(PFX)),"^",2),APAT1=$P($G(ENM(PFX)),"^",3) D LS
Q
LS ;
W !,AZFM1_"-("_PFX_")",?40,AZVER1,?50,LPAT1 I AZFM1="IHS V FILES 200 CONVERSION" D PCC2
Q
;SAVE PACKAGE STATUS DATA TO A UNIX FILE
XBC ;XBGL=GLOBAL NAME,XBUF=UNIX DIRECTORY,XBFN=UNIX FILE NAME
;Next line will try to send file to 92.145 with ftpsend
;
;S XBGL="AZFMENV",XBUF="127.0.0.1",XBFN="AZFMENV"_AZASUFAC_".G",XBMED="F"
S XBGL="AZFMENV(",XBFN="AZFMENV"_AZASUFAC_".G",XBMED="F"
S XBS1="AZFMSITETRACK"
;S XBGL="AZFMENV",XBUF="/usr2/ihs/emoore",XBFN="AZFMENV"_AZASUFAC_".G",XBMED="F"
D ^XBGSAVE
Q
AZFMENV ;IHS/OIT/ENM - PHARMACY ENVIRONMENT CHECK [ 02/13/2006 2:54 PM ]
+1 ;;IHS PHARMACY MODIFICATIONS;;
ALLPKG ;LOOP ON PACKAGE FILE "B" XREF
+1 SET AZFMSITE=""
SET PKRN=""
SET AZASUFAC=""
SET AZFMCT=1
+2 IF $GET(DUZ)'>0!('$DATA(DUZ(0)))
WRITE !,"YOUR DUZ VARIABLES ARE NOT DEFINED! AT THE PROMPT, ENTER 'D ^XUP'",!,"AND RUN THIS PROGRAM AFTERWARDS.",!
QUIT
+3 IF $GET(DUZ(2))>0
SET AZFMSITE=$PIECE($GET(^DIC(4,DUZ(2),0)),"^",1)
SET AZASUFAC=$PIECE($GET(^AUTTLOC(DUZ(2),0)),"^",10)
WRITE !,"SITE NAME: ",AZFMSITE_" "_AZASUFAC,!
+4 WRITE !,"SOURCE: Package File - Package Name - Current Version - Last Patch",!
+5 WRITE !,"PACKAGE NAME",?40,"CURRENT",?50,"LATEST",!,?40,"VERSION",?50,"PATCH/DATE",!,"------------",?40,"---------------",?50,"----------"
+6 SET AZFM=""
SET LPATCH=""
SET LPAT=""
+7 FOR NA=0:0
SET AZFM=$ORDER(^DIC(9.4,"B",AZFM))
IF AZFM=""
QUIT
DO PKGWR
+8 ;D XBC ;MOVE XTMP GBL TO UNIX
+9 DO OUT
+10 QUIT
PKGWR SET AZVER=$$VERSION^XPDUTL(AZFM)
SET LPATCH=$$LAST^AZFMENV2(AZFM,AZVER)
SET LPATCH=$SELECT(LPATCH'[-1:LPATCH,1:"")
DO DTFIX
+1 IF LPATCH=""
SET LPAT=""
+2 IF LPATCH]""
SET LPAT=$PIECE(LPATCH,"^",1)_" / "_$PIECE(LPATCH,"^",2)
+3 ;GRAB THE PREFIX
+4 SET PKRN=$ORDER(^DIC(9.4,"B",AZFM,""))
IF 'PKRN
SET PKRN=""
+5 SET PREFIX=$PIECE($GET(^DIC(9.4,PKRN,0)),"^",2)
+6 WRITE !,AZFM_"-("_PREFIX_")",?40,AZVER,?50,LPAT
IF AZFM="IHS V FILES 200 CONVERSION"
DO PCC2
+7 SET ^AZFMENV(AZFMCT)=AZASUFAC_"^"_AZFM_"^"_AZVER_"^"_LPAT
+8 SET AZFMCT=AZFMCT+1
+9 QUIT
PCC2 SET PCCF200=$PIECE($GET(^AUTTSITE(1,0)),"^",22)
IF PCCF200=""
SET PCCF200="No"
+1 IF PCCF200=1
SET PCCF200="YES"
+2 WRITE !,?30,"IHS V Files 200 Conversion Done?// ",PCCF200
+3 QUIT
DOONE ;DO ONE RECORD FOR TESTING ONLY
+1 SET AZFM="ADVERSE REACTION TRACKING"
DO PKGWR
+2 DO OUT
+3 QUIT
DTFIX IF '+LPATCH
QUIT
+1 SET Y=$PIECE(LPATCH,"^",2)
XECUTE ^DD("DD")
SET $PIECE(LPATCH,"^",2)=" "_Y
+2 QUIT
OUT ;
+1 WRITE !!,"END OF PACKAGE FILE PROFILE CHECK!"
+2 KILL NA,AZFM,AZVER,LPATCH,PCCF200,AZASUFAC
+3 QUIT
PFIX SET AZFMSITE=""
SET PKRN=""
+1 IF $GET(DUZ)'>0!('$DATA(DUZ(0)))
WRITE !,"YOUR DUZ VARIABLES ARE NOT DEFINED! AT THE PROMPT, ENTER 'D ^XUP'",!,"AND RUN THIS PROGRAM AFTERWARDS.",!
QUIT
+2 IF $GET(DUZ(2))>0
SET AZFMSITE=$PIECE($GET(^DIC(4,DUZ(2),0)),"^",1)
WRITE !,"SITE NAME: ",AZFMSITE,!
+3 WRITE !,"SOURCE: Package File - Package Name - Current Version - Last Patch",!
+4 WRITE !,"PACKAGE NAME",?40,"CURRENT",?50,"LATEST",!,?40,"VERSION",?50,"PATCH/DATE",!,"------------",?40,"---------------",?50,"----------"
+5 SET AZFM=""
SET LPATCH=""
SET LPAT=""
+6 FOR NA=0:0
SET AZFM=$ORDER(^DIC(9.4,"B",AZFM))
IF AZFM=""
QUIT
DO PGWR
+7 DO OP2
+8 DO OUT
+9 QUIT
PGWR SET AZVER=$$VERSION^XPDUTL(AZFM)
SET LPATCH=$$LAST^AZFMENV2(AZFM,AZVER)
SET LPATCH=$SELECT(LPATCH'[-1:LPATCH,1:"")
DO DTFIX
+1 IF LPATCH=""
SET LPAT=""
+2 IF LPATCH]""
SET LPAT=$PIECE(LPATCH,"^",1)_" / "_$PIECE(LPATCH,"^",2)
+3 ;GRAB THE PREFIX
+4 SET PKRN=$ORDER(^DIC(9.4,"B",AZFM,""))
IF 'PKRN
SET PKRN=""
+5 SET PREFIX=$PIECE($GET(^DIC(9.4,PKRN,0)),"^",2)
+6 ;W !,AZFM_"-("_PREFIX_")",?40,AZVER,?50,LPAT I AZFM="IHS V FILES 200 CONVERSION" D PCC2
+7 SET ENM(PREFIX)=AZFM_"^"_AZVER_"^"_LPAT
+8 QUIT
OP2 ;
+1 SET PFX=""
SET AZFM1=""
SET AZVER1=""
SET APAT1=""
+2 FOR
SET PFX=$ORDER(ENM(PFX))
IF 'PFX
QUIT
SET AZFM1=$PIECE($GET(ENM(PFX)),"^",1)
SET AZVER1=$PIECE($GET(ENM(PFX)),"^",2)
SET APAT1=$PIECE($GET(ENM(PFX)),"^",3)
DO LS
+3 QUIT
LS ;
+1 WRITE !,AZFM1_"-("_PFX_")",?40,AZVER1,?50,LPAT1
IF AZFM1="IHS V FILES 200 CONVERSION"
DO PCC2
+2 QUIT
+3 ;SAVE PACKAGE STATUS DATA TO A UNIX FILE
XBC ;XBGL=GLOBAL NAME,XBUF=UNIX DIRECTORY,XBFN=UNIX FILE NAME
+1 ;Next line will try to send file to 92.145 with ftpsend
+2 ;
+3 ;S XBGL="AZFMENV",XBUF="127.0.0.1",XBFN="AZFMENV"_AZASUFAC_".G",XBMED="F"
+4 SET XBGL="AZFMENV("
SET XBFN="AZFMENV"_AZASUFAC_".G"
SET XBMED="F"
+5 SET XBS1="AZFMSITETRACK"
+6 ;S XBGL="AZFMENV",XBUF="/usr2/ihs/emoore",XBFN="AZFMENV"_AZASUFAC_".G",XBMED="F"
+7 DO ^XBGSAVE
+8 QUIT