PSAP54 ;VMP/RJS BUILD XTMP("PSAVSN" FROM A FLAT FILE ; 14MAR06
;;3.0;DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**54**;10/24/97
; Reference to %ZISH supported by DBIA # 2320
; Reference to XPDUTL supported by DBIA #10141
;
W:$D(IOF) @IOF
W !," Build McKesson VSN to Dispense Units Per Order Unit and Drug Description Data"
W !!,"This Utility is used to build the ^XTMP(""PSAVSN"" global with then McKesson VSN,",!,"DUOU & Description. Please follow these steps prior to running this utility:",!
W !,"1) Retrieve the MCKESSON_UPDATE.DAT in ASCII format directly from one of these",!,?5,"FTP servers:"
W !,?5,"Albany ftp.fo-albany.domain.ext",!,?5,"Hines ftp.fo-hines.domain.ext",!,?5,"Salt Lake City ftp.fo-slc.domain.ext"
W !," The preferred FTP server retrieve the file from download.vista.domain.ext",!," which will transmit the files from the first available FTP server."
W !!,"2) At the HOST DIRECTORY: prompt enter the name of the directory that you",!," placed the file in. i.e. USER$:[TEMP]"
W !!,?5,"If you enter an invalid directory this utility will return you to the",!,?5,"HOST DIRECTORY: prompt: Enter ^ to Quit:",!!
N DUOUT,X,Y
DIR S DIR(0)="F^3:30",DIR("A")="HOST DIRECTORY" D ^DIR Q:$D(DUOUT) K DIR
S PSADIR=X
S DIR(0)="F^3:30",DIR("A")="HOST FILENAME",DIR("B")="MCKESSON_UPDATE.DAT" D ^DIR Q:$D(DUOUT) K DIR
S PSAFILE=X
S Y=$$FTG^%ZISH(PSADIR,PSAFILE,$NA(^TMP("PSAVSN",1,0)),2)
I Y'>0 W !,?5,"INVALID DIRECTORY NAME OR FILE DOES NOT EXIST",!,?5,"PLEASE ENTER THE DIRECTORY AGAIN" G DIR
S PSADATA=$G(^TMP("PSAVSN",1,0))
G:$L(PSADATA)>100 ERRMSG
S PSAFLDT=$P(PSADATA,"^",5),PSADESC=$P(PSADATA,"^",4)
I $G(^XTMP("PSAVSN",0)),$P(^XTMP("PSAVSN",0),"^",4)=PSAFLDT W !,"The McKesson Update for ",PSAFLDT," has already been installed",!,"Please try downloading the file again." K ^TMP("PSAVSN") G END
W !!,"PROCESSING PLEASE WAIT "
EN S PSADT=$$FMADD^XLFDT(DT,360)
S ^XTMP("PSAVSN",0)=PSADT_"^"_DT_"^"_PSADESC_"^"_PSAFLDT
S PSAREC=1,PSACNTR=0
F S PSAREC=$O(^TMP("PSAVSN",PSAREC)) Q:PSAREC="" D
.S PSACNTR=PSACNTR+1
.I '$D(XPDQUES),PSACNTR=1000 S PSACNTR=0 W "."
.S PSADATA=$G(^TMP("PSAVSN",PSAREC,0))
.Q:PSADATA=""
.S PSAVSN=$P(PSADATA,"^",1),PSADUOU=$P(PSADATA,"^",2),PSADESC=$P(PSADATA,"^",3)
.S ^XTMP("PSAVSN",PSAVSN)=PSADUOU_"~"_PSADESC
I '$D(XPDQUES) W !!,"PROCESSING COMPLETE. The ^XTMP(""PSAVSN"" global has been updated"
END K ^TMP("PSAVSN"),PSAREC,PSADATA,PSAVSN,PSADUOU,PSADESC,PSACNTR,PSADT,PSADIR,PSAFILE,PSAFLDT
Q
;
ERRMSG ; ERROR MESSAGE IF FILE WAS DOWNLOAD IN BINARY FORMAT
K ^TMP("PSAVSN"),PSAREC,PSADATA,PSAVSN,PSADUOU,PSADESC,PSACNTR,PSADT,PSADIR,PSAFILE,PSAFLDT
W !!,?10,"There was a problem with the input file."
W !,?9,"It may have been downloaded in BINARY mode."
W !,?6,"Please try downloading it again using ASCII mode.",!!
Q
;
POSINIT ; PATCH POST INSTALL
S PSADIR=XPDQUES("POSPSADIR"),PSAFILE=XPDQUES("POSPSAFILE")
S Y=$$FTG^%ZISH(PSADIR,PSAFILE,$NA(^TMP("PSAVSN",1,0)),2)
I Y'>0 G POSERR1
S PSADATA=$G(^TMP("PSAVSN",1,0))
G:$L(PSADATA)>100 POSERR3
S PSAFLDT=$P(PSADATA,"^",5),PSADESC=$P(PSADATA,"^",4)
I $G(^XTMP("PSAVSN",0)),$P(^XTMP("PSAVSN",0),"^",4)=PSAFLDT G POSERR2
G:$L($G(^TMP("PSAVSN",1,0)))>100 POSERR3
D MES^XPDUTL("PROCESSING PLEASE WAIT")
D EN
D MES^XPDUTL("PROCESSING COMPLETE. The ^XTMP(""PSAVSN"" global has been updated")
Q
;
POSERR1 ; ERROR MESSAGE IF FILE COULD NOT BE OPENED
S MSG="DIRECTORY = "_PSADIR_" FILENAME = "_PSAFILE
D BMES^XPDUTL(MSG)
D MES^XPDUTL("INVALID DIRECTORY NAME/FILENAME OR FILE DOES NOT EXIST")
D MES^XPDUTL("Please verify that the DIRECTORY is correct and that the")
D MES^XPDUTL("MCKESSON_UPDATE.DAT file is present")
D BMES^XPDUTL("Once you have verified that the DIRECTORY name is correct and/or")
D MES^XPDUTL("the file is present, Please run ^PSAP54 from the programmers prompt.")
K PSADIR,PSAFILE
Q
;
POSERR2 ; ERROR MESSAGE IF FILE WAS FUOUND BUT HAS ALREADY BEEN INSTALLED
S MSG="The McKesson Update for "_PSAFLDT_" has already been installed"
D BMES^XPDUTL(MSG)
D MES^XPDUTL("Please try downloading the file again.")
D MES^XPDUTL("Then run ^PSAP54 from the programmers prompt.")
K ^TMP("PSAVSN"),MSG,PSADIR,PSAFILE
Q
;
POSERR3 ; ERROR MESSAGE IF THE FLAT FILE WAS DOWNLOADED IN BINARY FORMAT
D BMES^XPDUTL("There was a problem with the MCKESSON_UPDATE.DAT file")
D MES^XPDUTL("Please download it again using ASCII format and")
D MES^XPDUTL("run ^PSAP54 from the programmers prompt")
K ^TMP("PSAVSN"),PSADIR,PSAFILE
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSAP54 4608 printed Nov 22, 2024@17:00:09 Page 2
PSAP54 ;VMP/RJS BUILD XTMP("PSAVSN" FROM A FLAT FILE ; 14MAR06
+1 ;;3.0;DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**54**;10/24/97
+2 ; Reference to %ZISH supported by DBIA # 2320
+3 ; Reference to XPDUTL supported by DBIA #10141
+4 ;
+5 if $DATA(IOF)
WRITE @IOF
+6 WRITE !," Build McKesson VSN to Dispense Units Per Order Unit and Drug Description Data"
+7 WRITE !!,"This Utility is used to build the ^XTMP(""PSAVSN"" global with then McKesson VSN,",!,"DUOU & Description. Please follow these steps prior to running this utility:",!
+8 WRITE !,"1) Retrieve the MCKESSON_UPDATE.DAT in ASCII format directly from one of these",!,?5,"FTP servers:"
+9 WRITE !,?5,"Albany ftp.fo-albany.domain.ext",!,?5,"Hines ftp.fo-hines.domain.ext",!,?5,"Salt Lake City ftp.fo-slc.domain.ext"
+10 WRITE !," The preferred FTP server retrieve the file from download.vista.domain.ext",!," which will transmit the files from the first available FTP server."
+11 WRITE !!,"2) At the HOST DIRECTORY: prompt enter the name of the directory that you",!," placed the file in. i.e. USER$:[TEMP]"
+12 WRITE !!,?5,"If you enter an invalid directory this utility will return you to the",!,?5,"HOST DIRECTORY: prompt: Enter ^ to Quit:",!!
+13 NEW DUOUT,X,Y
DIR SET DIR(0)="F^3:30"
SET DIR("A")="HOST DIRECTORY"
DO ^DIR
if $DATA(DUOUT)
QUIT
KILL DIR
+1 SET PSADIR=X
+2 SET DIR(0)="F^3:30"
SET DIR("A")="HOST FILENAME"
SET DIR("B")="MCKESSON_UPDATE.DAT"
DO ^DIR
if $DATA(DUOUT)
QUIT
KILL DIR
+3 SET PSAFILE=X
+4 SET Y=$$FTG^%ZISH(PSADIR,PSAFILE,$NAME(^TMP("PSAVSN",1,0)),2)
+5 IF Y'>0
WRITE !,?5,"INVALID DIRECTORY NAME OR FILE DOES NOT EXIST",!,?5,"PLEASE ENTER THE DIRECTORY AGAIN"
GOTO DIR
+6 SET PSADATA=$GET(^TMP("PSAVSN",1,0))
+7 if $LENGTH(PSADATA)>100
GOTO ERRMSG
+8 SET PSAFLDT=$PIECE(PSADATA,"^",5)
SET PSADESC=$PIECE(PSADATA,"^",4)
+9 IF $GET(^XTMP("PSAVSN",0))
IF $PIECE(^XTMP("PSAVSN",0),"^",4)=PSAFLDT
WRITE !,"The McKesson Update for ",PSAFLDT," has already been installed",!,"Please try downloading the file again."
KILL ^TMP("PSAVSN")
GOTO END
+10 WRITE !!,"PROCESSING PLEASE WAIT "
EN SET PSADT=$$FMADD^XLFDT(DT,360)
+1 SET ^XTMP("PSAVSN",0)=PSADT_"^"_DT_"^"_PSADESC_"^"_PSAFLDT
+2 SET PSAREC=1
SET PSACNTR=0
+3 FOR
SET PSAREC=$ORDER(^TMP("PSAVSN",PSAREC))
if PSAREC=""
QUIT
Begin DoDot:1
+4 SET PSACNTR=PSACNTR+1
+5 IF '$DATA(XPDQUES)
IF PSACNTR=1000
SET PSACNTR=0
WRITE "."
+6 SET PSADATA=$GET(^TMP("PSAVSN",PSAREC,0))
+7 if PSADATA=""
QUIT
+8 SET PSAVSN=$PIECE(PSADATA,"^",1)
SET PSADUOU=$PIECE(PSADATA,"^",2)
SET PSADESC=$PIECE(PSADATA,"^",3)
+9 SET ^XTMP("PSAVSN",PSAVSN)=PSADUOU_"~"_PSADESC
End DoDot:1
+10 IF '$DATA(XPDQUES)
WRITE !!,"PROCESSING COMPLETE. The ^XTMP(""PSAVSN"" global has been updated"
END KILL ^TMP("PSAVSN"),PSAREC,PSADATA,PSAVSN,PSADUOU,PSADESC,PSACNTR,PSADT,PSADIR,PSAFILE,PSAFLDT
+1 QUIT
+2 ;
ERRMSG ; ERROR MESSAGE IF FILE WAS DOWNLOAD IN BINARY FORMAT
+1 KILL ^TMP("PSAVSN"),PSAREC,PSADATA,PSAVSN,PSADUOU,PSADESC,PSACNTR,PSADT,PSADIR,PSAFILE,PSAFLDT
+2 WRITE !!,?10,"There was a problem with the input file."
+3 WRITE !,?9,"It may have been downloaded in BINARY mode."
+4 WRITE !,?6,"Please try downloading it again using ASCII mode.",!!
+5 QUIT
+6 ;
POSINIT ; PATCH POST INSTALL
+1 SET PSADIR=XPDQUES("POSPSADIR")
SET PSAFILE=XPDQUES("POSPSAFILE")
+2 SET Y=$$FTG^%ZISH(PSADIR,PSAFILE,$NAME(^TMP("PSAVSN",1,0)),2)
+3 IF Y'>0
GOTO POSERR1
+4 SET PSADATA=$GET(^TMP("PSAVSN",1,0))
+5 if $LENGTH(PSADATA)>100
GOTO POSERR3
+6 SET PSAFLDT=$PIECE(PSADATA,"^",5)
SET PSADESC=$PIECE(PSADATA,"^",4)
+7 IF $GET(^XTMP("PSAVSN",0))
IF $PIECE(^XTMP("PSAVSN",0),"^",4)=PSAFLDT
GOTO POSERR2
+8 if $LENGTH($GET(^TMP("PSAVSN",1,0)))>100
GOTO POSERR3
+9 DO MES^XPDUTL("PROCESSING PLEASE WAIT")
+10 DO EN
+11 DO MES^XPDUTL("PROCESSING COMPLETE. The ^XTMP(""PSAVSN"" global has been updated")
+12 QUIT
+13 ;
POSERR1 ; ERROR MESSAGE IF FILE COULD NOT BE OPENED
+1 SET MSG="DIRECTORY = "_PSADIR_" FILENAME = "_PSAFILE
+2 DO BMES^XPDUTL(MSG)
+3 DO MES^XPDUTL("INVALID DIRECTORY NAME/FILENAME OR FILE DOES NOT EXIST")
+4 DO MES^XPDUTL("Please verify that the DIRECTORY is correct and that the")
+5 DO MES^XPDUTL("MCKESSON_UPDATE.DAT file is present")
+6 DO BMES^XPDUTL("Once you have verified that the DIRECTORY name is correct and/or")
+7 DO MES^XPDUTL("the file is present, Please run ^PSAP54 from the programmers prompt.")
+8 KILL PSADIR,PSAFILE
+9 QUIT
+10 ;
POSERR2 ; ERROR MESSAGE IF FILE WAS FUOUND BUT HAS ALREADY BEEN INSTALLED
+1 SET MSG="The McKesson Update for "_PSAFLDT_" has already been installed"
+2 DO BMES^XPDUTL(MSG)
+3 DO MES^XPDUTL("Please try downloading the file again.")
+4 DO MES^XPDUTL("Then run ^PSAP54 from the programmers prompt.")
+5 KILL ^TMP("PSAVSN"),MSG,PSADIR,PSAFILE
+6 QUIT
+7 ;
POSERR3 ; ERROR MESSAGE IF THE FLAT FILE WAS DOWNLOADED IN BINARY FORMAT
+1 DO BMES^XPDUTL("There was a problem with the MCKESSON_UPDATE.DAT file")
+2 DO MES^XPDUTL("Please download it again using ASCII format and")
+3 DO MES^XPDUTL("run ^PSAP54 from the programmers prompt")
+4 KILL ^TMP("PSAVSN"),PSADIR,PSAFILE
+5 QUIT