| 1 | AWCMFTP1 ;VISN7/THM-FTP FILES TO NATIONAL ROLL-UP SERVER from VISTA ; Feb 27, 2004
|
---|
| 2 | ;;7.3;TOOLKIT;**84,86**;Jan 09, 2004
|
---|
| 3 | ;
|
---|
| 4 | W *7,!,"Enter at line EN^AWCMFTP1.",!
|
---|
| 5 | Q
|
---|
| 6 | EN ; variables killed in calling program
|
---|
| 7 | S VMSC="" ;INIT THE VAR
|
---|
| 8 | S AWCHFILE="AWCMOVESTAT.COM" ;COM file name
|
---|
| 9 | I AWCX="NT" S AWCHFILE=AWCFILE
|
---|
| 10 | S AWCDTAX=$G(^AWC(177100.12,1,0))
|
---|
| 11 | S AWCDIR=$P(AWCDTAX,U,5) ;Parameter file
|
---|
| 12 | S:AWCDIR="" AWCDIR="SYS$SYSDEVICE:[DSMMGR]" ;DEFAULT
|
---|
| 13 | S AWCSITE=$$SITE^VASITE,AWCSITE=$P(AWCSITE,U,2) ;site Name
|
---|
| 14 | S AWCSITEN=+$$SITE^VASITE ;3 dig number
|
---|
| 15 | S AWCDIRL=$$LOW^XLFSTR(AWCDIR),AWCHFILL=$$LOW^XLFSTR(AWCHFILE)
|
---|
| 16 | S AWCDTX=$G(^AWC(177100.12,1,1))
|
---|
| 17 | S AWCWBFLD=$P(^AWC(177100.12,1,0),U,15),AWCWBFLD=$$LOW^XLFSTR(AWCWBFLD) ;web page folder
|
---|
| 18 | S AWCMVMSL=$P(AWCDTAX,U,16) ;VMS logging on or off
|
---|
| 19 | S AWCMVMSD=$P(AWCDTAX,U,18) ;DELETE COM files on or off
|
---|
| 20 | S AWCWBFLD=$P(AWCWBFLD,"/",2)
|
---|
| 21 | S AWCDIRCH=+$P(AWCDTAX,U,19) ;use change dir command?
|
---|
| 22 | S AWCMSRV=$P(AWCDTX,U,6),AWCMUSR=$P(AWCDTX,U,7),AWCMPW=$P(AWCDTX,U,8)
|
---|
| 23 | D @AWCX
|
---|
| 24 | Q
|
---|
| 25 | ;
|
---|
| 26 | NT S AWCC=1
|
---|
| 27 | K ^TMP("AWCMFTP1",$J)
|
---|
| 28 | S ^TMP("AWCMFTP1",$J,AWCC,0)="open "_AWCMSRV,AWCC=AWCC+1 ;server ip address
|
---|
| 29 | S ^TMP("AWCMFTP1",$J,AWCC,0)=AWCMUSR,AWCC=AWCC+1 ; ftp user
|
---|
| 30 | S ^TMP("AWCMFTP1",$J,AWCC,0)=AWCMPW,AWCC=AWCC+1 ;ftp password
|
---|
| 31 | S ^TMP("AWCMFTP1",$J,AWCC,0)="ascii",AWCC=AWCC+1
|
---|
| 32 | S ^TMP("AWCMFTP1",$J,AWCC,0)="put "_AWCDIRL_"\"_AWCHFILE,AWCC=AWCC+1
|
---|
| 33 | S ^TMP("AWCMFTP1",$J,AWCC,0)="bye"
|
---|
| 34 | ; write it to the NT directory
|
---|
| 35 | S Y=$$GTF^%ZISH($NA(^TMP("AWCMFTP1",$J,1,0)),3,AWCDIRL,"ftpstatawc.txt")
|
---|
| 36 | ; send command to NT to execute this batch file
|
---|
| 37 | S CMD="S AWCVAR=$ZF(-1,""ftp -s:"_AWCDIRL_"\ftpstatawc.txt"")" X CMD
|
---|
| 38 | G EXIT
|
---|
| 39 | ;
|
---|
| 40 | VMSC ; VMS FOR CACHE MODS TO DOUBLE CHECK FOR OS
|
---|
| 41 | S VMSC=1
|
---|
| 42 | ;
|
---|
| 43 | VMS K ^TMP("AWCMFTP1",$J)
|
---|
| 44 | S AWC=1,^TMP("AWCMFTP1",$J,AWC,0)="$ set noon"
|
---|
| 45 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ set proc/priv = all"
|
---|
| 46 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ assign sys$command sys$input "
|
---|
| 47 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ set verify"
|
---|
| 48 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ a=""''f$user()'"""
|
---|
| 49 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ set def "_AWCDIR
|
---|
| 50 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCDIR_AWCHFILE
|
---|
| 51 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ ftp "_AWCMSRV
|
---|
| 52 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)=AWCMUSR
|
---|
| 53 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)=AWCMPW
|
---|
| 54 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="ascii"
|
---|
| 55 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="put "_AWCHFIL1
|
---|
| 56 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="bye"
|
---|
| 57 | ; purge or keep log files after FTP
|
---|
| 58 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ wait 00:01"
|
---|
| 59 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCDIR_AWCHFILE_";*"
|
---|
| 60 | I AWCMVMSL=1 S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ purge/keep=1 "_AWCDIR_"AWCMOVESTAT.LOG"
|
---|
| 61 | I AWCMVMSL=0 S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ delete "_AWCDIR_"AWCMOVESTAT.LOG;*"
|
---|
| 62 | ; purge or delete all web page versions after FTP
|
---|
| 63 | I AWCMVMSD=1 S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ delete "_AWCDIR_AWCHFILE_";*"
|
---|
| 64 | I AWCMVMSD=0 S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ purge/keep=1 "_AWCDIR_AWCHFILE
|
---|
| 65 | ; delete the stat text file - automatic,not user controlled
|
---|
| 66 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ delete CPRSstats*.*;*"
|
---|
| 67 | S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ exit"
|
---|
| 68 | ; send to VMS
|
---|
| 69 | S Y=$$GTF^%ZISH($NA(^TMP("AWCMFTP1",$J,1,0)),3,AWCDIR,AWCHFILE)
|
---|
| 70 | G:VMSC VMSC1
|
---|
| 71 | ; USE $&ZLIB EXTERNAL CALLS FOR DSM
|
---|
| 72 | S CMD="S %SUBMIT=$&ZLIB.%SUBMIT"_"("""_AWCDIR_AWCHFILE_""""_","_"""/NOPRINT"_$S(AWCMVMSL=1:"/LOG="_AWCDIR_"AWCMOVESTAT.LOG"""_")",1:"/NOLOG"""_")")
|
---|
| 73 | X CMD
|
---|
| 74 | G EXIT
|
---|
| 75 | VMSC1 ;
|
---|
| 76 | ; vms cache
|
---|
| 77 | ; USE $ZF CALLS FOR OS COMMANDS IN CACHE
|
---|
| 78 | S CMD="S AWCVAR=$ZF(-1,AWCVAR)"
|
---|
| 79 | S AWCVAR="SUBMIT "_AWCDIR_AWCHFILE_"/NOPRINT"_$S(AWCMVMSL=1:"/LOG="_AWCDIR_"AWCMOVESTAT.LOG",1:"/NOLOG")
|
---|
| 80 | X CMD
|
---|
| 81 | ;
|
---|
| 82 | EXIT ;
|
---|
| 83 | K CMD,^TMP("AWCMFTP1",$J),AWCMVMSL,AWCMVMSD,AWCDTAX,AWCDTX,AWC,AWCMANL
|
---|
| 84 | Q
|
---|