source: FOIAVistA/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAP54.m@ 1166

Last change on this file since 1166 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1PSAP54 ;VMP/RJS BUILD XTMP("PSAVSN" FROM A FLAT FILE ; 14MAR06
2 ;;3.0;DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**54**;10/24/97
3 ; Reference to %ZISH supported by DBIA # 2320
4 ; Reference to XPDUTL supported by DBIA #10141
5 ;
6 W:$D(IOF) @IOF
7 W !," Build McKesson VSN to Dispense Units Per Order Unit and Drug Description Data"
8 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:",!
9 W !,"1) Retrieve the MCKESSON_UPDATE.DAT in ASCII format directly from one of these",!,?5,"FTP servers:"
10 W !,?5,"Albany ftp.fo-albany.med.va.gov",!,?5,"Hines ftp.fo-hines.med.va.gov",!,?5,"Salt Lake City ftp.fo-slc.med.va.gov"
11 W !," The preferred FTP server retrieve the file from download.vista.med.va.gov",!," which will transmit the files from the first available FTP server."
12 W !!,"2) At the HOST DIRECTORY: prompt enter the name of the directory that you",!," placed the file in. i.e. USER$:[TEMP]"
13 W !!,?5,"If you enter an invalid directory this utility will return you to the",!,?5,"HOST DIRECTORY: prompt: Enter ^ to Quit:",!!
14 N DUOUT,X,Y
15DIR S DIR(0)="F^3:30",DIR("A")="HOST DIRECTORY" D ^DIR Q:$D(DUOUT) K DIR
16 S PSADIR=X
17 S DIR(0)="F^3:30",DIR("A")="HOST FILENAME",DIR("B")="MCKESSON_UPDATE.DAT" D ^DIR Q:$D(DUOUT) K DIR
18 S PSAFILE=X
19 S Y=$$FTG^%ZISH(PSADIR,PSAFILE,$NA(^TMP("PSAVSN",1,0)),2)
20 I Y'>0 W !,?5,"INVALID DIRECTORY NAME OR FILE DOES NOT EXIST",!,?5,"PLEASE ENTER THE DIRECTORY AGAIN" G DIR
21 S PSADATA=$G(^TMP("PSAVSN",1,0))
22 G:$L(PSADATA)>100 ERRMSG
23 S PSAFLDT=$P(PSADATA,"^",5),PSADESC=$P(PSADATA,"^",4)
24 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
25 W !!,"PROCESSING PLEASE WAIT "
26EN S PSADT=$$FMADD^XLFDT(DT,360)
27 S ^XTMP("PSAVSN",0)=PSADT_"^"_DT_"^"_PSADESC_"^"_PSAFLDT
28 S PSAREC=1,PSACNTR=0
29 F S PSAREC=$O(^TMP("PSAVSN",PSAREC)) Q:PSAREC="" D
30 .S PSACNTR=PSACNTR+1
31 .I '$D(XPDQUES),PSACNTR=1000 S PSACNTR=0 W "."
32 .S PSADATA=$G(^TMP("PSAVSN",PSAREC,0))
33 .Q:PSADATA=""
34 .S PSAVSN=$P(PSADATA,"^",1),PSADUOU=$P(PSADATA,"^",2),PSADESC=$P(PSADATA,"^",3)
35 .S ^XTMP("PSAVSN",PSAVSN)=PSADUOU_"~"_PSADESC
36 I '$D(XPDQUES) W !!,"PROCESSING COMPLETE. The ^XTMP(""PSAVSN"" global has been updated"
37END K ^TMP("PSAVSN"),PSAREC,PSADATA,PSAVSN,PSADUOU,PSADESC,PSACNTR,PSADT,PSADIR,PSAFILE,PSAFLDT
38 Q
39 ;
40ERRMSG ; ERROR MESSAGE IF FILE WAS DOWNLOAD IN BINARY FORMAT
41 K ^TMP("PSAVSN"),PSAREC,PSADATA,PSAVSN,PSADUOU,PSADESC,PSACNTR,PSADT,PSADIR,PSAFILE,PSAFLDT
42 W !!,?10,"There was a problem with the input file."
43 W !,?9,"It may have been downloaded in BINARY mode."
44 W !,?6,"Please try downloading it again using ASCII mode.",!!
45 Q
46 ;
47POSINIT ; PATCH POST INSTALL
48 S PSADIR=XPDQUES("POSPSADIR"),PSAFILE=XPDQUES("POSPSAFILE")
49 S Y=$$FTG^%ZISH(PSADIR,PSAFILE,$NA(^TMP("PSAVSN",1,0)),2)
50 I Y'>0 G POSERR1
51 S PSADATA=$G(^TMP("PSAVSN",1,0))
52 G:$L(PSADATA)>100 POSERR3
53 S PSAFLDT=$P(PSADATA,"^",5),PSADESC=$P(PSADATA,"^",4)
54 I $G(^XTMP("PSAVSN",0)),$P(^XTMP("PSAVSN",0),"^",4)=PSAFLDT G POSERR2
55 G:$L($G(^TMP("PSAVSN",1,0)))>100 POSERR3
56 D MES^XPDUTL("PROCESSING PLEASE WAIT")
57 D EN
58 D MES^XPDUTL("PROCESSING COMPLETE. The ^XTMP(""PSAVSN"" global has been updated")
59 Q
60 ;
61POSERR1 ; ERROR MESSAGE IF FILE COULD NOT BE OPENED
62 S MSG="DIRECTORY = "_PSADIR_" FILENAME = "_PSAFILE
63 D BMES^XPDUTL(MSG)
64 D MES^XPDUTL("INVALID DIRECTORY NAME/FILENAME OR FILE DOES NOT EXIST")
65 D MES^XPDUTL("Please verify that the DIRECTORY is correct and that the")
66 D MES^XPDUTL("MCKESSON_UPDATE.DAT file is present")
67 D BMES^XPDUTL("Once you have verified that the DIRECTORY name is correct and/or")
68 D MES^XPDUTL("the file is present, Please run ^PSAP54 from the programmers prompt.")
69 K PSADIR,PSAFILE
70 Q
71 ;
72POSERR2 ; ERROR MESSAGE IF FILE WAS FUOUND BUT HAS ALREADY BEEN INSTALLED
73 S MSG="The McKesson Update for "_PSAFLDT_" has already been installed"
74 D BMES^XPDUTL(MSG)
75 D MES^XPDUTL("Please try downloading the file again.")
76 D MES^XPDUTL("Then run ^PSAP54 from the programmers prompt.")
77 K ^TMP("PSAVSN"),MSG,PSADIR,PSAFILE
78 Q
79 ;
80POSERR3 ; ERROR MESSAGE IF THE FLAT FILE WAS DOWNLOADED IN BINARY FORMAT
81 D BMES^XPDUTL("There was a problem with the MCKESSON_UPDATE.DAT file")
82 D MES^XPDUTL("Please download it again using ASCII format and")
83 D MES^XPDUTL("run ^PSAP54 from the programmers prompt")
84 K ^TMP("PSAVSN"),PSADIR,PSAFILE
85 Q
Note: See TracBrowser for help on using the repository browser.