Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: XMSFTP

XMSFTP.m

Go to the documentation of this file.
  1. XMSFTP ;(WASH ISC)/CAP-TCP/IP-FTP Sender ;04/17/2002 11:29
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ;TCP/IP-FTP COMMUNICATIONS
  1. ;Send file via FTP / File located on another TCP/IP node
  1. FTP K TEST N XMIO S XMIO=$I
  1. ;
  1. ;Get unique number for file to send
  1. S (XMSFTP,X)=$G(^XMBX(4.2995,"F",0))+1,^(0)=X
  1. ;
  1. S FILE="XM"_X_".COM" O FILE:NEW U FILE
  1. W "$! FTP COM procedure for fetching file from server and sending it",!
  1. W "$ set noon",!
  1. W "$ assign/user nla0: sys$output",! ;Turn off echo
  1. W "$ assign/user sys$input sys$command",!
  1. ;
  1. ;FTP to Get or Put location
  1. W "$ FTP=""$TWG$TCP:[NETDIST.USER]FTP",!
  1. W "$ FTP "
  1. I $L($G(XMSFTP(1))) W XMSFTP(1),!
  1. E W XMSFTP(3),! G PUT
  1. ;
  1. ;Get file from local network
  1. S %=$G(XMSFTP(4)) W %,!
  1. S %=$G(XMSFTP(5)) I $L(%) W %,!
  1. W "bin",!
  1. W "get "_$P(XMSFTP(2),U,2)_XMSFTP(2,"F")_" "_XMSFTP(2,"F"),!
  1. W "close",!
  1. ;
  1. ;Put file to remote location
  1. W "open "_XMSFTP(3),! G P
  1. PUT S %=$G(XMSFTP(6)) W %,!
  1. P S %=$G(XMSFTP(7)) I $L(%) H 3 W %,! I $L($G(XMSFTP(7.1))) H 3 W XMSFTP(7.1),!
  1. W "bin",!
  1. W "cd nfa0:[IMPORT.MAIL]",!
  1. ;
  1. ;Need to know directory on remote side
  1. S %=$G(XMSFTP(8)) I $L(%) W "cd "_%,!
  1. S %=$G(XMSFTP(2)) I $L(%) W "cd "_%,!
  1. W "delete "_XMSFTP(2,"F"),!
  1. W "put nfa0:[EXPORT.MAIL]"_XMSFTP(2,"F"),!
  1. C FILE
  1. ;
  1. ;The following code originally spawned off an FTP transaction
  1. ;immediately when the XMnnn.COM file was created. It has been
  1. ;replaced with code in XMRTCP.
  1. ;
  1. ;S %=$H*86400+$P($H,",",2)+600,%H=%\86400_","_(%#86400) D YX^%DTC S %=$P($P(Y,",")," ",2)_"-"_$P(Y," ")_"-"_$P($P(Y,"@"),", ",2)_":"_$P(Y,"@",2)
  1. ;
  1. S X=$$FILE(FILE) K FILE,XMTMPFIL
  1. U XMIO Q
  1. B36 ;Calculate base 36 number
  1. N %,N,O,I,Z S O=X,%=X#36+1 D N S Y=N
  1. S %=X\(36)#36+1 D N S Y=N_Y
  1. S %=X\(36*36)#36+1 D N S Y=N_Y
  1. S %=X\(36*36*36)#36+1 D N S Y=N_Y
  1. S X=O Q
  1. Q
  1. N S N=$E("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",%)
  1. Q
  1. FILE(X) ;Add record to FTP list
  1. N DD,DO,DIC,DTOUT,DUOUT,Y
  1. S DIC="^XMBX(4.2995,",DIC(0)="LF",DIC("DR")="1///"_($H*86400+$P($H,",",2))_";2///"_$S($G(XMDUZ):XMDUZ,1:DUZ)
  1. D FILE^DICN S %=$G(XMSFTP("IMAGE-PTR")) I % S $P(^XMBX(4.2995,+Y,0),U,4)=%
  1. Q Y
  1. TEST S TEST=1
  1. ;;XMSFTP(1)=get file IP address (EG 89.0.0.79 - sstu)
  1. ;;XMSFTP(2)=DOS dir / subdir... Other than default to IMPORT file into
  1. ;;XMSFTP(2,"F")=File to get (s:\image\nfibpd2.756)
  1. ;;XMSFTP(3)=put to IP address
  1. ;;XMSFTP(4)=User ID at origination node
  1. ;;XMSFTP(5)=User Password at origination node
  1. ;;XMSFTP(6)=User ID at destination node
  1. ;;XMSFTP(7)=User Password at destination node
  1. ;;XMSFTP(8)=FTP IMPORT PATH [VMS has DIR.SUBD..., see XMSFTP(2) for DOS]
  1. Q
  1. ;
  1. ;To display image on Pete's terminal
  1. ;>stage
  1. ;>C:\t\test3 file_name
  1. ;
  1. ;find differences: diff file1 file2 (no display=no differences)