AWCMFTP1 ;VISN7/THM-FTP FILES TO NATIONAL ROLL-UP SERVER from VISTA ; Feb 27, 2004
;;7.3;TOOLKIT;**84,86**;Jan 09, 2004
;
W *7,!,"Enter at line EN^AWCMFTP1.",!
Q
EN ; variables killed in calling program
S VMSC="" ;INIT THE VAR
S AWCHFILE="AWCMOVESTAT.COM" ;COM file name
I AWCX="NT" S AWCHFILE=AWCFILE
S AWCDTAX=$G(^AWC(177100.12,1,0))
S AWCDIR=$P(AWCDTAX,U,5) ;Parameter file
S:AWCDIR="" AWCDIR="SYS$SYSDEVICE:[DSMMGR]" ;DEFAULT
S AWCSITE=$$SITE^VASITE,AWCSITE=$P(AWCSITE,U,2) ;site Name
S AWCSITEN=+$$SITE^VASITE ;3 dig number
S AWCDIRL=$$LOW^XLFSTR(AWCDIR),AWCHFILL=$$LOW^XLFSTR(AWCHFILE)
S AWCDTX=$G(^AWC(177100.12,1,1))
S AWCWBFLD=$P(^AWC(177100.12,1,0),U,15),AWCWBFLD=$$LOW^XLFSTR(AWCWBFLD) ;web page folder
S AWCMVMSL=$P(AWCDTAX,U,16) ;VMS logging on or off
S AWCMVMSD=$P(AWCDTAX,U,18) ;DELETE COM files on or off
S AWCWBFLD=$P(AWCWBFLD,"/",2)
S AWCDIRCH=+$P(AWCDTAX,U,19) ;use change dir command?
S AWCMSRV=$P(AWCDTX,U,6),AWCMUSR=$P(AWCDTX,U,7),AWCMPW=$P(AWCDTX,U,8)
D @AWCX
Q
;
NT S AWCC=1
K ^TMP("AWCMFTP1",$J)
S ^TMP("AWCMFTP1",$J,AWCC,0)="open "_AWCMSRV,AWCC=AWCC+1 ;server ip address
S ^TMP("AWCMFTP1",$J,AWCC,0)=AWCMUSR,AWCC=AWCC+1 ; ftp user
S ^TMP("AWCMFTP1",$J,AWCC,0)=AWCMPW,AWCC=AWCC+1 ;ftp password
S ^TMP("AWCMFTP1",$J,AWCC,0)="ascii",AWCC=AWCC+1
S ^TMP("AWCMFTP1",$J,AWCC,0)="put "_AWCDIRL_"\"_AWCHFILE,AWCC=AWCC+1
S ^TMP("AWCMFTP1",$J,AWCC,0)="bye"
; write it to the NT directory
S Y=$$GTF^%ZISH($NA(^TMP("AWCMFTP1",$J,1,0)),3,AWCDIRL,"ftpstatawc.txt")
; send command to NT to execute this batch file
S CMD="S AWCVAR=$ZF(-1,""ftp -s:"_AWCDIRL_"\ftpstatawc.txt"")" X CMD
G EXIT
;
VMSC ; VMS FOR CACHE MODS TO DOUBLE CHECK FOR OS
S VMSC=1
;
VMS K ^TMP("AWCMFTP1",$J)
S AWC=1,^TMP("AWCMFTP1",$J,AWC,0)="$ set noon"
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ set proc/priv = all"
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ assign sys$command sys$input "
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ set verify"
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ a=""''f$user()'"""
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ set def "_AWCDIR
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCDIR_AWCHFILE
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ ftp "_AWCMSRV
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)=AWCMUSR
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)=AWCMPW
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="ascii"
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="put "_AWCHFIL1
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="bye"
; purge or keep log files after FTP
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ wait 00:01"
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCDIR_AWCHFILE_";*"
I AWCMVMSL=1 S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ purge/keep=1 "_AWCDIR_"AWCMOVESTAT.LOG"
I AWCMVMSL=0 S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ delete "_AWCDIR_"AWCMOVESTAT.LOG;*"
; purge or delete all web page versions after FTP
I AWCMVMSD=1 S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ delete "_AWCDIR_AWCHFILE_";*"
I AWCMVMSD=0 S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ purge/keep=1 "_AWCDIR_AWCHFILE
; delete the stat text file - automatic,not user controlled
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ delete CPRSstats*.*;*"
S AWC=AWC+1,^TMP("AWCMFTP1",$J,AWC,0)="$ exit"
; send to VMS
S Y=$$GTF^%ZISH($NA(^TMP("AWCMFTP1",$J,1,0)),3,AWCDIR,AWCHFILE)
G:VMSC VMSC1
; USE $&ZLIB EXTERNAL CALLS FOR DSM
S CMD="S %SUBMIT=$&ZLIB.%SUBMIT"_"("""_AWCDIR_AWCHFILE_""""_","_"""/NOPRINT"_$S(AWCMVMSL=1:"/LOG="_AWCDIR_"AWCMOVESTAT.LOG"""_")",1:"/NOLOG"""_")")
X CMD
G EXIT
VMSC1 ;
; vms cache
; USE $ZF CALLS FOR OS COMMANDS IN CACHE
S CMD="S AWCVAR=$ZF(-1,AWCVAR)"
S AWCVAR="SUBMIT "_AWCDIR_AWCHFILE_"/NOPRINT"_$S(AWCMVMSL=1:"/LOG="_AWCDIR_"AWCMOVESTAT.LOG",1:"/NOLOG")
X CMD
;
EXIT ;
K CMD,^TMP("AWCMFTP1",$J),AWCMVMSL,AWCMVMSD,AWCDTAX,AWCDTX,AWC,AWCMANL
Q
AWCMFTP1 ;VISN7/THM-FTP FILES TO NATIONAL ROLL-UP SERVER from VISTA ; Feb 27, 2004
+1 ;;7.3;TOOLKIT;**84,86**;Jan 09, 2004
+2 ;
+3 WRITE *7,!,"Enter at line EN^AWCMFTP1.",!
+4 QUIT
EN ; variables killed in calling program
+1 ;INIT THE VAR
SET VMSC=""
+2 ;COM file name
SET AWCHFILE="AWCMOVESTAT.COM"
+3 IF AWCX="NT"
SET AWCHFILE=AWCFILE
+4 SET AWCDTAX=$GET(^AWC(177100.12,1,0))
+5 ;Parameter file
SET AWCDIR=$PIECE(AWCDTAX,U,5)
+6 ;DEFAULT
IF AWCDIR=""
SET AWCDIR="SYS$SYSDEVICE:[DSMMGR]"
+7 ;site Name
SET AWCSITE=$$SITE^VASITE
SET AWCSITE=$PIECE(AWCSITE,U,2)
+8 ;3 dig number
SET AWCSITEN=+$$SITE^VASITE
+9 SET AWCDIRL=$$LOW^XLFSTR(AWCDIR)
SET AWCHFILL=$$LOW^XLFSTR(AWCHFILE)
+10 SET AWCDTX=$GET(^AWC(177100.12,1,1))
+11 ;web page folder
SET AWCWBFLD=$PIECE(^AWC(177100.12,1,0),U,15)
SET AWCWBFLD=$$LOW^XLFSTR(AWCWBFLD)
+12 ;VMS logging on or off
SET AWCMVMSL=$PIECE(AWCDTAX,U,16)
+13 ;DELETE COM files on or off
SET AWCMVMSD=$PIECE(AWCDTAX,U,18)
+14 SET AWCWBFLD=$PIECE(AWCWBFLD,"/",2)
+15 ;use change dir command?
SET AWCDIRCH=+$PIECE(AWCDTAX,U,19)
+16 SET AWCMSRV=$PIECE(AWCDTX,U,6)
SET AWCMUSR=$PIECE(AWCDTX,U,7)
SET AWCMPW=$PIECE(AWCDTX,U,8)
+17 DO @AWCX
+18 QUIT
+19 ;
NT SET AWCC=1
+1 KILL ^TMP("AWCMFTP1",$JOB)
+2 ;server ip address
SET ^TMP("AWCMFTP1",$JOB,AWCC,0)="open "_AWCMSRV
SET AWCC=AWCC+1
+3 ; ftp user
SET ^TMP("AWCMFTP1",$JOB,AWCC,0)=AWCMUSR
SET AWCC=AWCC+1
+4 ;ftp password
SET ^TMP("AWCMFTP1",$JOB,AWCC,0)=AWCMPW
SET AWCC=AWCC+1
+5 SET ^TMP("AWCMFTP1",$JOB,AWCC,0)="ascii"
SET AWCC=AWCC+1
+6 SET ^TMP("AWCMFTP1",$JOB,AWCC,0)="put "_AWCDIRL_"\"_AWCHFILE
SET AWCC=AWCC+1
+7 SET ^TMP("AWCMFTP1",$JOB,AWCC,0)="bye"
+8 ; write it to the NT directory
+9 SET Y=$$GTF^%ZISH($NAME(^TMP("AWCMFTP1",$JOB,1,0)),3,AWCDIRL,"ftpstatawc.txt")
+10 ; send command to NT to execute this batch file
+11 SET CMD="S AWCVAR=$ZF(-1,""ftp -s:"_AWCDIRL_"\ftpstatawc.txt"")"
XECUTE CMD
+12 GOTO EXIT
+13 ;
VMSC ; VMS FOR CACHE MODS TO DOUBLE CHECK FOR OS
+1 SET VMSC=1
+2 ;
VMS KILL ^TMP("AWCMFTP1",$JOB)
+1 SET AWC=1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ set noon"
+2 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ set proc/priv = all"
+3 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ assign sys$command sys$input "
+4 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ set verify"
+5 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ a=""''f$user()'"""
+6 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ set def "_AWCDIR
+7 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCDIR_AWCHFILE
+8 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ ftp "_AWCMSRV
+9 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)=AWCMUSR
+10 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)=AWCMPW
+11 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="ascii"
+12 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="put "_AWCHFIL1
+13 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="bye"
+14 ; purge or keep log files after FTP
+15 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ wait 00:01"
+16 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ set prot=(w:rwed,g:rwed,o:rwed,s:rwed) "_AWCDIR_AWCHFILE_";*"
+17 IF AWCMVMSL=1
SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ purge/keep=1 "_AWCDIR_"AWCMOVESTAT.LOG"
+18 IF AWCMVMSL=0
SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ delete "_AWCDIR_"AWCMOVESTAT.LOG;*"
+19 ; purge or delete all web page versions after FTP
+20 IF AWCMVMSD=1
SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ delete "_AWCDIR_AWCHFILE_";*"
+21 IF AWCMVMSD=0
SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ purge/keep=1 "_AWCDIR_AWCHFILE
+22 ; delete the stat text file - automatic,not user controlled
+23 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ delete CPRSstats*.*;*"
+24 SET AWC=AWC+1
SET ^TMP("AWCMFTP1",$JOB,AWC,0)="$ exit"
+25 ; send to VMS
+26 SET Y=$$GTF^%ZISH($NAME(^TMP("AWCMFTP1",$JOB,1,0)),3,AWCDIR,AWCHFILE)
+27 IF VMSC
GOTO VMSC1
+28 ; USE $&ZLIB EXTERNAL CALLS FOR DSM
+29 SET CMD="S %SUBMIT=$&ZLIB.%SUBMIT"_"("""_AWCDIR_AWCHFILE_""""_","_"""/NOPRINT"_$SELECT(AWCMVMSL=1:"/LOG="_AWCDIR_"AWCMOVESTAT.LOG"""_")",1:"/NOLOG"""_")")
+30 XECUTE CMD
+31 GOTO EXIT
VMSC1 ;
+1 ; vms cache
+2 ; USE $ZF CALLS FOR OS COMMANDS IN CACHE
+3 SET CMD="S AWCVAR=$ZF(-1,AWCVAR)"
+4 SET AWCVAR="SUBMIT "_AWCDIR_AWCHFILE_"/NOPRINT"_$SELECT(AWCMVMSL=1:"/LOG="_AWCDIR_"AWCMOVESTAT.LOG",1:"/NOLOG")
+5 XECUTE CMD
+6 ;
EXIT ;
+1 KILL CMD,^TMP("AWCMFTP1",$JOB),AWCMVMSL,AWCMVMSD,AWCDTAX,AWCDTX,AWC,AWCMANL
+2 QUIT