source: WorldVistAEHR/trunk/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/AWCMFTP.m@ 862

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

initial load of WorldVistAEHR

File size: 5.7 KB
RevLine 
[613]1AWCMFTP ;VISN 7/THM-FTP FILES TO SERVER from VISTA ; Feb 27, 2004
2 ;;7.3;TOOLKIT;**84,86,103**;Jan 09, 2004;Build 4
3 ;
4 W *7,!,"Enter at line EN^AWCMFTP.",!
5 Q
6EN ; variables killed in calling program
7 S VMSC="" ;INIT THE VAR
8 ; AWCHFIL1= whole VMS path
9 S AWCHFILE="AWCMOVEHTM.COM" ;COM file name
10 I AWCX="NT" S AWCHFILE=AWCFILE
11 S AWCDTAX=$G(^AWC(177100.12,1,0))
12 S AWCDIR=$P(AWCDTAX,U,5) ;Parameter file
13 S:AWCDIR="" AWCDIR="SYS$SYSDEVICE:[DSMMGR]" ;DEFAULT
14 S AWCSITE=$$SITE^VASITE,AWCSITE=$P(AWCSITE,U,2) ;site Name
15 S AWCSITEN=+$$SITE^VASITE ;3 dig number
16 S AWCDIRL=$$LOW^XLFSTR(AWCDIR),AWCHFILL=$$LOW^XLFSTR(AWCHFILE)
17 S AWCWBFLD=$P(AWCDTAX,U,15),AWCWBFLD=$$LOW^XLFSTR(AWCWBFLD) ;web page folder
18 ; Note: file deletion is not a problem for NT/Cache since it overwrites the files
19 S AWCMVMSL=+$P(AWCDTAX,U,16) ;VMS logging
20 S AWCMVMSD=+$P(AWCDTAX,U,18) ;VMS delete
21 S AWCDIRCH=+$P(AWCDTAX,U,19) ;use change dir command?
22 S AWCWBFLD=$P(AWCWBFLD,"/",2)
23 D @AWCX
24 Q
25 ;
26NT ; NT script
27 S AWCC=1
28 K ^TMP("AWCMFTP",$J)
29 S ^TMP("AWCMFTP",$J,AWCC,0)="open "_AWCMSRV,AWCC=AWCC+1 ;server ip address
30 S ^TMP("AWCMFTP",$J,AWCC,0)=AWCMUSR,AWCC=AWCC+1 ; ftp user
31 S ^TMP("AWCMFTP",$J,AWCC,0)=AWCMPW,AWCC=AWCC+1 ;ftp password
32 S ^TMP("AWCMFTP",$J,AWCC,0)="ascii",AWCC=AWCC+1
33 I $G(AWCDIRCH)=1 S ^TMP("AWCMFTP",$J,AWCC,0)="cd "_AWCWBFLD,AWCC=AWCC+1 ;****
34 S ^TMP("AWCMFTP",$J,AWCC,0)="put "_AWCDIRL_"\"_AWCHFILE,AWCC=AWCC+1 ;****
35 S ^TMP("AWCMFTP",$J,AWCC,0)="bye"
36 ; write it to the NT directory
37 S Y=$$GTF^%ZISH($NA(^TMP("AWCMFTP",$J,1,0)),3,AWCDIRL,"ftpawc.txt")
38 ; send command to NT to execute this batch file
39 S CMD="S AWCVAR=$ZF(-1,""ftp -s:""_AWCDIRL_""\ftpawc.txt"")"
40 X CMD G EXIT
41 ;
42VMSC ; VMS FOR CACHE MODS TO DOUBLE CHECK FOR OS
43 S VMSC=1
44 ;
45VMS ; VMS com file script
46 ; Captive process so we give full privs
47 S AWC=1
48 K ^TMP("AWCMFTP",$J)
49 S ^TMP("AWCMFTP",$J,AWC,0)="$ set proc/priv = all"
50 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="$ set noon"
51 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="$ assign sys$command sys$input "
52 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="$ set verify"
53 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="$ a=""''f$user()'"""
54 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="$ set def "_AWCDIR
55 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCDIR_AWCHFILE
56 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="$ ftp "_AWCMSRV
57 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)=AWCMUSR
58 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)=AWCMPW
59 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="ascii"
60 I $G(AWCDIRCH)=1 S ^TMP("AWCMFTP",$J,AWC,0)="cd "_AWCWBFLD ;****
61 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="put "_AWCHFIL1
62 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="bye"
63 S AWC=AWC+1,^TMP("AWCMFTP",$J,AWC,0)="$ exit"
64 ; send to VMS
65 S Y=$$GTF^%ZISH($NA(^TMP("AWCMFTP",$J,1,0)),3,AWCDIR,AWCHFILE)
66 G:VMSC VMSC1
67 ;
68 ; USE $&ZLIB EXTERNAL CALLS FOR DSM/VMS
69 S CMD="S %SUBMIT=$&ZLIB.%SUBMIT"_"("""_AWCDIR_AWCHFILE_""""_","_"""/NOPRINT"_$S(AWCMVMSL=1:"/LOG="_AWCDIR_$P(AWCHFILE,".",1)_".LOG"""_")",1:"/NOLOG"""_")")
70 X CMD
71 G EXIT
72VMSC1 ;
73 ; VMS Cache - use $ZF(-1 calls for OS commands
74 S CMD="S AWCVAR=$ZF(-1,AWCVAR)"
75 S AWCVAR="SUBMIT "_AWCDIR_AWCHFILE_"/NOPRINT"_$S(AWCMVMSL=1:"/LOG="_AWCDIR_$P(AWCHFILE,".",1)_".LOG",1:"/NOLOG")
76 X CMD
77 ;
78EXIT K CMD,^TMP("AWCMFTP"),^TMP("AWCMFTPD"),AWCMVMSL,AWCMVMSD,AWCDTAX,AWC,AWCDIRCH
79 Q
80 ;
81PURDEL ; purging/deletion script - whether this occurs is controlled in file 177100.12
82 ; this part creates a com file to purge or delete files we have created and then it deletes itself
83 ;
84 S AWCDTAX=$G(^AWC(177100.12,1,0))
85 S AWCMVMSL=+$P(AWCDTAX,U,16) ;VMS logging
86 S AWCMVMSD=+$P(AWCDTAX,U,18) ;VMS delete
87 S AWCHFILE="AWCPURGE.COM"
88 ; captive process again so we give full privs
89 K ^TMP("AWCMFTPD",$J)
90 S AWC=1,^TMP("AWCMFTPD",$J,AWC,0)="$ wait 00:05"
91 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ set proc/priv = all"
92 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ set noon"
93 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ assign sys$command sys$input "
94 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ set verify"
95 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ a=""''f$user()'"""
96 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ set def "_AWCDIR
97 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCDIR_"AWCMOVEHTM.LOG;*"
98 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCDIR_"AWCMOVEHTM.COM;*"
99 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCHFIL1_";*"
100 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCDIR_"AWCPURGE.COM;*"
101 ; purge or keep log files - 0 deletes all, 1 leaves one copy
102 I AWCMVMSL=1 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ purge/keep=1 "_AWCDIR_"AWCMOVEHTM.LOG"
103 I AWCMVMSL=0 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ delete "_AWCDIR_"AWCMOVEHTM.LOG;*"
104 ; purge or delete all COM versions - 0 deletes all, 1 leaves one copy
105 I AWCMVMSD=1 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ delete "_AWCDIR_"AWCMOVEHTM.COM;*"
106 I AWCMVMSD=0 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ purge/keep=1 "_AWCDIR_"AWCMOVEHTM.COM;*"
107 ; delete the web pages - automatic, not user controlled
108 ; patch 103 change for RDPC environment jls/oak-oifo 10/2006
109 ;S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ delete "_$P(AWCHFIL1,"_",1)_"*.*;*"
110 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ delete "_AWCDIR_$P(AWCDTAX,U,6)_"*.*;*"
111 S AWC=AWC+1,^TMP("AWCMFTPD",$J,AWC,0)="$ exit"
112 ; send to VMS
113 S Y=$$GTF^%ZISH($NA(^TMP("AWCMFTPD",$J,1,0)),3,AWCDIR,AWCHFILE)
114 I AWCX="VMS" S CMD="S %SUBMIT=$&ZLIB.%SUBMIT"_"("""_AWCDIR_AWCHFILE_""""_","_"""/DELETE /NOPRINT /NOLOG"""_")"
115 I AWCX="VMSC" S CMD="S AWCVAR=$ZF(-1,AWCVAR)"
116 I AWCX="VMSC" S AWCVAR="SUBMIT "_AWCDIR_AWCHFILE_"/DELETE /NOPRINT /NOLOG"
117 X CMD
118 Q
Note: See TracBrowser for help on using the repository browser.