| [613] | 1 | XMSFTPUX ;(WASH ISC)/CAP-TCP/IP-FTP Sender ;04/17/2002  11:30
 | 
|---|
 | 2 |  ;;8.0;MailMan;;Jun 28, 2002
 | 
|---|
 | 3 |  ;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 | 
|---|
 | 4 |  ;XXX/KCMO - Modified for UCX, added a field to the network location
 | 
|---|
 | 5 |  ;file called 'maps to reference' that can be used to map the DOS 
 | 
|---|
 | 6 |  ;locations to Unix/VMS references.
 | 
|---|
 | 7 |  ;-----------------------------------------------------------------
 | 
|---|
 | 8 |  ;
 | 
|---|
 | 9 |  ;TCP/IP-FTP COMMUNICATIONS
 | 
|---|
 | 10 |  ;Send file via FTP / File located on another TCP/IP node
 | 
|---|
 | 11 | FTP K TEST N XMIO,OREF,LOC,FILE,IFILE S XMIO=$I
 | 
|---|
 | 12 |  ;
 | 
|---|
 | 13 |  ;Get unique number for file to send
 | 
|---|
 | 14 |  S (XMSFTP,X)=$G(^XMBX(4.2995,"F",0))+1,^(0)=X
 | 
|---|
 | 15 |  ;
 | 
|---|
 | 16 | XX S LOC=$P($G(^MAG(2005,+XMSFTP("IMAGE-PTR"),0)),U,3)
 | 
|---|
 | 17 |  S OREF=$P($G(^MAG(2005.2,LOC,589001)),U)
 | 
|---|
 | 18 |  ;
 | 
|---|
 | 19 |  S FILE="XM"_X_".COM",IFILE="XM"_X_".INP" O FILE:NEW O IFILE:NEW U FILE
 | 
|---|
 | 20 |  W "$! FTP COM procedure for sending binary files, UCX/XXX",!
 | 
|---|
 | 21 |  W "$ set noon",!
 | 
|---|
 | 22 |  W "$ ftp:=$ucx$ftp/ultrix",!
 | 
|---|
 | 23 |  W "$ ftp /input="_IFILE_" "_XMSFTP(3),!
 | 
|---|
 | 24 |  W "$ exit !Need to check status",! C FILE G PUT
 | 
|---|
 | 25 |  ;
 | 
|---|
 | 26 |  ;Get file from local network
 | 
|---|
 | 27 |  S %=$G(XMSFTP(4)) W %,!
 | 
|---|
 | 28 |  S %=$G(XMSFTP(5)) I $L(%) W %,!
 | 
|---|
 | 29 |  W "bin",!
 | 
|---|
 | 30 |  W "get "_$P(XMSFTP(2),U,2)_XMSFTP(2,"F")_" "_XMSFTP(2,"F"),!
 | 
|---|
 | 31 |  W "close",!
 | 
|---|
 | 32 |  ;
 | 
|---|
 | 33 |  ;Put file to remote location
 | 
|---|
 | 34 |  W "open "_XMSFTP(3),! G P
 | 
|---|
 | 35 |  ;
 | 
|---|
 | 36 | PUT U IFILE
 | 
|---|
 | 37 |  S %=$G(XMSFTP(6)) W "user ",%," "
 | 
|---|
 | 38 | P S %=$G(XMSFTP(7)) I $L(%) H 3 W %,! I $L($G(XMSFTP(7.1))) H 3 W XMSFTP(7.1),!
 | 
|---|
 | 39 |  W "bin",!
 | 
|---|
 | 40 |  W "lcd ",OREF,!
 | 
|---|
 | 41 |  ;
 | 
|---|
 | 42 |  ;Need to know directory on remote side
 | 
|---|
 | 43 |  S %=$G(XMSFTP(8)) I $L(%) W "cd "_%,!
 | 
|---|
 | 44 |  S %=$G(XMSFTP(2)) I $L(%) W "cd "_%,!
 | 
|---|
 | 45 |  W "delete "_XMSFTP(2,"F")_";*",!
 | 
|---|
 | 46 |  W "put ",XMSFTP(2,"F"),!
 | 
|---|
 | 47 |  C IFILE
 | 
|---|
 | 48 |  ;
 | 
|---|
 | 49 |  ;The following code originally spawned off an FTP transaction
 | 
|---|
 | 50 |  ;immediately when the XMnnn.COM file was created.  It has been
 | 
|---|
 | 51 |  ;replaced with code in XMRTCP.
 | 
|---|
 | 52 |  ;
 | 
|---|
 | 53 |  ;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)
 | 
|---|
 | 54 |  ;
 | 
|---|
 | 55 |  S X=$$FILE(FILE) K FILE,XMTMPFIL
 | 
|---|
 | 56 |  U XMIO Q
 | 
|---|
 | 57 | B36 ;Calculate base 36 number
 | 
|---|
 | 58 |  N %,N,O,I,Z S O=X,%=X#36+1 D N S Y=N
 | 
|---|
 | 59 |  S %=X\(36)#36+1 D N S Y=N_Y
 | 
|---|
 | 60 |  S %=X\(36*36)#36+1 D N S Y=N_Y
 | 
|---|
 | 61 |  S %=X\(36*36*36)#36+1 D N S Y=N_Y
 | 
|---|
 | 62 |  S X=O Q
 | 
|---|
 | 63 |  Q
 | 
|---|
 | 64 | N S N=$E("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",%)
 | 
|---|
 | 65 |  Q
 | 
|---|
 | 66 | FILE(X) ;Add record to FTP list
 | 
|---|
 | 67 |  N DD,DO,DIC,DTOUT,DUOUT,Y
 | 
|---|
 | 68 |  S DIC="^XMBX(4.2995,",DIC(0)="LF",DIC("DR")="1///"_($H*86400+$P($H,",",2))_";2///"_$S($G(XMDUZ):XMDUZ,1:DUZ)
 | 
|---|
 | 69 |  D FILE^DICN S %=$G(XMSFTP("IMAGE-PTR")) I % S $P(^XMBX(4.2995,+Y,0),U,4)=%
 | 
|---|
 | 70 |  Q Y
 | 
|---|
 | 71 | TEST S TEST=1
 | 
|---|
 | 72 |  ;;XMSFTP(1)=get file IP address (EG   89.0.0.79 - sstu)
 | 
|---|
 | 73 |  ;;XMSFTP(2)=DOS dir / subdir... Other than default to IMPORT file into
 | 
|---|
 | 74 |  ;;XMSFTP(2,"F")=File to get (s:\image\nfibpd2.756)
 | 
|---|
 | 75 |  ;;XMSFTP(3)=put to IP address
 | 
|---|
 | 76 |  ;;XMSFTP(4)=User ID at origination node
 | 
|---|
 | 77 |  ;;XMSFTP(5)=User Password at origination node
 | 
|---|
 | 78 |  ;;XMSFTP(6)=User ID at destination node
 | 
|---|
 | 79 |  ;;XMSFTP(7)=User Password at destination node
 | 
|---|
 | 80 |  ;;XMSFTP(8)=FTP IMPORT PATH [VMS has DIR.SUBD..., see XMSFTP(2) for DOS]
 | 
|---|
 | 81 |  Q
 | 
|---|
 | 82 |  ;
 | 
|---|
 | 83 |  ;To display image on Pete's terminal
 | 
|---|
 | 84 |  ;>stage
 | 
|---|
 | 85 |  ;>C:\t\test3 file_name
 | 
|---|
 | 86 |  ;
 | 
|---|
 | 87 |  ;find differences:  diff file1 file2 (no display=no differences)
 | 
|---|