PSO772PI ;BIRM/KML - PSO*7*772 Post-install routine ;12/4/2024
;;7.0;OUTPATIENT PHARMACY;**772**;DEC 1997;Build 105
;
EN ; MAIN ENTRY POINT
K ^TMP("PSO772PI",$J)
N LINENUM,ERROR,ROUTINES
S ERROR=0
S LINENUM=0
S ROUTINES=$$VALROUTINES()
I ROUTINES D VERSIONS,PROTOCOL
D DELROUTINES
D MAIL("PSO*7*772 Installation is completed.")
Q
;
VERSIONS ; Add new standard versions to the SPMP ASAP RECORD DEFINITION FILE (#58.4)
N V,S,D,E,L,X,DAVIEN,VERSION,ERR,VERNODE,COMPONENTS,NXT,TAG,NEW
S V="VER",S="SEG",D="DAT",E="DES",L="VAL" ;decrease bytes per line by referencing the subscripts
F NXT=2:1 S COMPONENTS=$T(VERLST+NXT),COMPONENTS=$P(COMPONENTS,";;",2) Q:COMPONENTS="" D
. S NEW=0
. S VERSION=$P(COMPONENTS,"|"),TAG=$P(COMPONENTS,"|",2)
. S DAVIEN=$$FIND1^DIC(58.4001,",1,","BX",VERSION,"","","ERR") ; get the ien for version to be added if it exists on installed system
. ;if Version needs to be added then get last IEN recorded and add 1 to create new record and update VERSION subfile ien counter
. S DAVIEN(1)=1 I DAVIEN D REMOVE(.DAVIEN,"^PS(58.4,1,""VER"",") ; if its on the system already, it will be removed
. I 'DAVIEN S VERNODE=^PS(58.4,1,"VER",0),DAVIEN=$P(VERNODE,"^",3)+1,NEW=1
. D @(TAG_"(V,"_"S,"_"D,"_"E,"_"L,"_DAVIEN_")")
. I NEW S $P(^PS(58.4,1,"VER",0),"^",3)=DAVIEN
. S $P(^PS(58.4,1,"VER",0),"^",4)=$P(^PS(58.4,1,"VER",0),"^",4)+1
. D REPORT("Standard Version "_VERSION_$P(COMPONENTS,"|",3)_" has been installed on the system and has been locked (READ ONLY).","COMPLETE",.LINENUM)
Q
;
;
PROTOCOL() ; populate the SCREEN field (#101,24) of the PSO SPMP3 MENU protocol with the M code enhancement
; returns back 1 for error state or 0 for successful file
N PRFDA,PRIEN,PRERROR
S PRIEN=+$$FIND1^DIC(101,,"X","PSO SPMP3 MENU","B")
I PRIEN S PRFDA(101,PRIEN_",",24)="I $$ACTIONS^PSOSPML3"
I $D(PRFDA) D FILE^DIE("E","PRFDA","PRERROR")
I $D(PRERROR) D REPORT("PSO SPMP3 MENU did not get updated with the necessary M SCREEN.","ERROR",.LINENUM) Q
D REPORT("Protocol PSO SPMP3 MENU has been updated with the M screen enhancement.","COMPLETE",.LINENUM)
Q
;
MAIL(XMSUB) ;Send mail message
N X,XMTEXT,XMY,XMDUZ,XMMG,XMSTRIP,XMROU,XMYBLOB,XMZ,XMDUN
S XMDUZ="PSO*7*772 Install"
S XMTEXT="^TMP(""PSO772PI"",$J,"
S XMY("G.PSO SPMP NOTIFICATIONS")=""
S XMY(DUZ)=""
N DIFROM D ^XMD
Q
;
REPORT(TEXT,ACTION,LINE) ; report any errors during web service setup
; Input -
; TEXT - text to report to end-user
; ACTION - what was being processed
; LINE - line number for the mail message passed in by reference
D:ACTION="REMOVED" 1
D:ACTION="ERROR" 2
D:ACTION="COMPLETE" 1
Q
1 D BMES^XPDUTL(" "_TEXT)
S LINE=LINE+1
S ^TMP("PSO772PI",$J,LINE)=" "_TEXT
S LINE=LINE+1
S ^TMP("PSO772PI",$J,LINE)=""
Q
;
2 D BMES^XPDUTL(" "_TEXT_" Please contact product support.")
S LINE=LINE+1
S ^TMP("PSO772PI",$J,LINE)=" Please log a SNOW Ticket and refer to this message."
S LINE=LINE+1
S ^TMP("PSO772PI",$J,LINE)=""
Q
;
REMOVE(DA,DIK) ; delete an entry from file or sub-file
; inputs -
; DA - Entry number in the subfile to delete (or top-file entry)
; DA(1) - Entry number at the next higher file level
; DIK - global root of the file from which to delete an entry
D ^DIK
Q
;
VALROUTINES() ; confirm that the post-install routines exist
N X,I,VAL
S VAL=1
F I=0:1:28 S X="PSO772P"_I X ^%ZOSF("TEST") I '$T S VAL=0
Q VAL
;
DELROUTINES ; delete post-install routines
N X,I
F I=0:1:28 S X="PSO772P"_I X ^%ZOSF("TEST") I $T D MES^XPDUTL("Deleting routine "_X_"...") X ^%ZOSF("DEL")
Q
;
VERLST ; list of versions to be added during install of PSO*7*772
;;ASAP VERSION|TAG^ROUTINE|indicates if Zero Report
;;4.2A|BUILD42A^PSO772P0|
;;4.2AZ|BUILD42AZ^PSO772P5| Zero Report
;;4.2B|BUILD42B^PSO772P8|
;;4.2BZ|BUILD42BZ^PSO772P13| Zero Report
;;5.0|BUILD5^PSO772P17|
;;5.0Z|BUILD5Z^PSO772P25| Zero Report
;;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSO772PI 3986 printed Sep 23, 2025@19:59:48 Page 2
PSO772PI ;BIRM/KML - PSO*7*772 Post-install routine ;12/4/2024
+1 ;;7.0;OUTPATIENT PHARMACY;**772**;DEC 1997;Build 105
+2 ;
EN ; MAIN ENTRY POINT
+1 KILL ^TMP("PSO772PI",$JOB)
+2 NEW LINENUM,ERROR,ROUTINES
+3 SET ERROR=0
+4 SET LINENUM=0
+5 SET ROUTINES=$$VALROUTINES()
+6 IF ROUTINES
DO VERSIONS
DO PROTOCOL
+7 DO DELROUTINES
+8 DO MAIL("PSO*7*772 Installation is completed.")
+9 QUIT
+10 ;
VERSIONS ; Add new standard versions to the SPMP ASAP RECORD DEFINITION FILE (#58.4)
+1 NEW V,S,D,E,L,X,DAVIEN,VERSION,ERR,VERNODE,COMPONENTS,NXT,TAG,NEW
+2 ;decrease bytes per line by referencing the subscripts
SET V="VER"
SET S="SEG"
SET D="DAT"
SET E="DES"
SET L="VAL"
+3 FOR NXT=2:1
SET COMPONENTS=$TEXT(VERLST+NXT)
SET COMPONENTS=$PIECE(COMPONENTS,";;",2)
if COMPONENTS=""
QUIT
Begin DoDot:1
+4 SET NEW=0
+5 SET VERSION=$PIECE(COMPONENTS,"|")
SET TAG=$PIECE(COMPONENTS,"|",2)
+6 ; get the ien for version to be added if it exists on installed system
SET DAVIEN=$$FIND1^DIC(58.4001,",1,","BX",VERSION,"","","ERR")
+7 ;if Version needs to be added then get last IEN recorded and add 1 to create new record and update VERSION subfile ien counter
+8 ; if its on the system already, it will be removed
SET DAVIEN(1)=1
IF DAVIEN
DO REMOVE(.DAVIEN,"^PS(58.4,1,""VER"",")
+9 IF 'DAVIEN
SET VERNODE=^PS(58.4,1,"VER",0)
SET DAVIEN=$PIECE(VERNODE,"^",3)+1
SET NEW=1
+10 DO @(TAG_"(V,"_"S,"_"D,"_"E,"_"L,"_DAVIEN_")")
+11 IF NEW
SET $PIECE(^PS(58.4,1,"VER",0),"^",3)=DAVIEN
+12 SET $PIECE(^PS(58.4,1,"VER",0),"^",4)=$PIECE(^PS(58.4,1,"VER",0),"^",4)+1
+13 DO REPORT("Standard Version "_VERSION_$PIECE(COMPONENTS,"|",3)_" has been installed on the system and has been locked (READ ONLY).","COMPLETE",.LINENUM)
End DoDot:1
+14 QUIT
+15 ;
+16 ;
PROTOCOL() ; populate the SCREEN field (#101,24) of the PSO SPMP3 MENU protocol with the M code enhancement
+1 ; returns back 1 for error state or 0 for successful file
+2 NEW PRFDA,PRIEN,PRERROR
+3 SET PRIEN=+$$FIND1^DIC(101,,"X","PSO SPMP3 MENU","B")
+4 IF PRIEN
SET PRFDA(101,PRIEN_",",24)="I $$ACTIONS^PSOSPML3"
+5 IF $DATA(PRFDA)
DO FILE^DIE("E","PRFDA","PRERROR")
+6 IF $DATA(PRERROR)
DO REPORT("PSO SPMP3 MENU did not get updated with the necessary M SCREEN.","ERROR",.LINENUM)
QUIT
+7 DO REPORT("Protocol PSO SPMP3 MENU has been updated with the M screen enhancement.","COMPLETE",.LINENUM)
+8 QUIT
+9 ;
MAIL(XMSUB) ;Send mail message
+1 NEW X,XMTEXT,XMY,XMDUZ,XMMG,XMSTRIP,XMROU,XMYBLOB,XMZ,XMDUN
+2 SET XMDUZ="PSO*7*772 Install"
+3 SET XMTEXT="^TMP(""PSO772PI"",$J,"
+4 SET XMY("G.PSO SPMP NOTIFICATIONS")=""
+5 SET XMY(DUZ)=""
+6 NEW DIFROM
DO ^XMD
+7 QUIT
+8 ;
REPORT(TEXT,ACTION,LINE) ; report any errors during web service setup
+1 ; Input -
+2 ; TEXT - text to report to end-user
+3 ; ACTION - what was being processed
+4 ; LINE - line number for the mail message passed in by reference
+5 if ACTION="REMOVED"
DO 1
+6 if ACTION="ERROR"
DO 2
+7 if ACTION="COMPLETE"
DO 1
+8 QUIT
1 DO BMES^XPDUTL(" "_TEXT)
+1 SET LINE=LINE+1
+2 SET ^TMP("PSO772PI",$JOB,LINE)=" "_TEXT
+3 SET LINE=LINE+1
+4 SET ^TMP("PSO772PI",$JOB,LINE)=""
+5 QUIT
+6 ;
2 DO BMES^XPDUTL(" "_TEXT_" Please contact product support.")
+1 SET LINE=LINE+1
+2 SET ^TMP("PSO772PI",$JOB,LINE)=" Please log a SNOW Ticket and refer to this message."
+3 SET LINE=LINE+1
+4 SET ^TMP("PSO772PI",$JOB,LINE)=""
+5 QUIT
+6 ;
REMOVE(DA,DIK) ; delete an entry from file or sub-file
+1 ; inputs -
+2 ; DA - Entry number in the subfile to delete (or top-file entry)
+3 ; DA(1) - Entry number at the next higher file level
+4 ; DIK - global root of the file from which to delete an entry
+5 DO ^DIK
+6 QUIT
+7 ;
VALROUTINES() ; confirm that the post-install routines exist
+1 NEW X,I,VAL
+2 SET VAL=1
+3 FOR I=0:1:28
SET X="PSO772P"_I
XECUTE ^%ZOSF("TEST")
IF '$TEST
SET VAL=0
+4 QUIT VAL
+5 ;
DELROUTINES ; delete post-install routines
+1 NEW X,I
+2 FOR I=0:1:28
SET X="PSO772P"_I
XECUTE ^%ZOSF("TEST")
IF $TEST
DO MES^XPDUTL("Deleting routine "_X_"...")
XECUTE ^%ZOSF("DEL")
+3 QUIT
+4 ;
VERLST ; list of versions to be added during install of PSO*7*772
+1 ;;ASAP VERSION|TAG^ROUTINE|indicates if Zero Report
+2 ;;4.2A|BUILD42A^PSO772P0|
+3 ;;4.2AZ|BUILD42AZ^PSO772P5| Zero Report
+4 ;;4.2B|BUILD42B^PSO772P8|
+5 ;;4.2BZ|BUILD42BZ^PSO772P13| Zero Report
+6 ;;5.0|BUILD5^PSO772P17|
+7 ;;5.0Z|BUILD5Z^PSO772P25| Zero Report
+8 ;;